{-# OPTIONS_GHC -O2 -optc-O2 #-}
module Main where

import Control.Applicative
import Control.Monad
import Data.Int
import Data.List

solve :: Int64 -> [Int64] -> Int64
solve t ds = t + (snd $ foldl' update (0, 0) ds)
    where update (p, total) c | p + t <= c = (c, total + t)
                              | otherwise = (c, total + c - p)

main :: IO ()
main = do
  [_, t] <- map read . words <$> getLine
  ds <- map read . words <$> getLine
  print $ solve t ds
