import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import Data.Char

solve vec t = (fst $ VU.foldl' step (0, 0) $ VU.tail vec) + t
    where
        step (a, b) v
            | b + t < v = (a + t, v)
            | otherwise = (a + a', v)
                where
                    a' = t - ((b + t) - v)

main = do
    [n, t] <- map read . words <$> getLine :: IO [Int]
    ts <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    print $ solve ts t