let () = Scanf.scanf "%d %d\n" @@ fun n t ->
    read_line ()
    |> Str.split (Str.regexp "[ \t]+")
    |> List.map int_of_string
    |> List.fold_left (fun (t1, sum) t2 -> (t2, sum + min (t2-t1) t)) (0, 0)
    |> function (_, sum) -> Printf.printf "%d" (sum + t)