import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.List

main :: IO ()
main = do
  [_, x] <- map read . words <$> getLine
  a <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
  let
    solve [] _ = 0
    solve (y:ys) s = let next = min y (s+x) in next + solve ys next
  print $ solve a 0
