void Solve(StreamScanner ss, StreamWriter sw) { //--------------------------------- var N = ss.Next(int.Parse); var T = ss.Next(long.Parse); var Tn = ss.Next(long.Parse, N); var ans = T; for (var i = 1; i < N; i++) { ans += Math.Min(T, Tn[i] - Tn[i - 1]); } sw.WriteLine(ans); //--------------------------------- }