let n, t0 = Scanf.scanf " %d %d" @@ fun a b -> a, b
let ts = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ans = ref 0
let _ = Array.iteri (fun i t -> ans := !ans + if i < n - 1 then min t0 @@ ts.(i + 1) - t else t0) ts; Printf.printf "%d\n" !ans