import Control.Applicative
 
main = do
  [n, t] <- map read . words <$> getLine
  ts <- map read . words <$> getLine
  putStr . show . f t $ ts

f t [] = 0
f t [u] = t
f t (u:us) = ((head us - u) `min` t) + f t us 