import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List as List


solve :: Integer -> [Integer] -> Integer
solve _ [] = 0
solve t [x] = t
solve t (x1:x2:xs) = n + (solve t (x2:xs))
    where
        n = min t (x2 - x1)

main :: IO()
main = do
    (n:t:_) <- map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine
    arr <- map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine
    print $ solve t arr   
