import Control.Monad
import Control.Applicative
import Data.List
import Data.Array

main = do

    [n , t]  <- (map read . words) <$> getLine
    tn <- map read . words <$> getLine
    print (solve t tn)
    


solve :: Int -> [Int] -> Int
solve t (x:[]) = t
solve t (x:ys) = min t ((head ys) - x) + (solve t ys)
