import qualified Data.ByteString.Char8 as BC
import Data.Maybe
readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BC.readInteger) . BC.words <$> BC.getLine
main = do
    [_,t] <- readIntegers
    ts <- readIntegers
    print $ (+t) . sum . map (min t) $ zipWith subtract ts (tail ts)