import Data.List
totalTime :: Int -> [Int] -> Int
totalTime _ [] = 0
totalTime t ts = snd $ foldl' f (head ts, t) (tail ts) where
  f (last, accum) next = (next, accum + min t (next - last))

main = do
  [ws1, ws2] <- (map words . lines) <$> getContents
  let t = read (ws1 !! 1)
  let ts = map read ws2
  print (totalTime t ts)
