open Batteries
let () =
  let n, l = Scanf.scanf "%d %d" (fun x y -> x, y) in
  let f (acc, prev) t = (acc + min l (t - prev), t) in
  List.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))
  |> List.fold_left f (0, -l)
  |> fst |> Printf.printf "%d\n"
