import Control.Monad
import Data.List

main=do
    [n,t]<-map read.words<$>getLine::IO[Int]
    print =<< fst.foldl (f t) (0,0).map read.words<$>getLine

f::Int->(Int,Int)->Int->(Int,Int)
f t (c,s) x
    | s<x  = (c+t,x+t)
    | True = (c+x+t-s, x+t)
