import Control.Applicative

main = do
  (n:t:_) <- (map read) . words <$> getLine
  ts <- (map read) . words <$> getLine

  print $ f ts t
  where
    f (x:[]) t = t
    f (x:y:xs) t = (if y-x < t then y-x else t) + (f (y:xs) t)
