import Control.Applicative
 
main = do
  [n, t] <- map read . words <$> getLine
  ts <- map read . words <$> getLine
  putStr . show . (+t) . foldl (f t) 0 $ ts
    where f u x y = x + (min (y - x) u)