import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as BS

main=do
    [n,t]<-map read.words<$>getLine::IO[Int]
    print =<< fst.foldl (f t) (0,0).unfoldr (BS.readInt.BS.dropWhile(==' '))<$>BS.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)
