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

main :: IO ()
main = do
  [n, x] <- map read . words <$> getLine
  a <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
  let
    solve [] (_, i) = (0, i)
    solve (y:ys) (s, i) =
      let
        (next, j) = if s + x * (i+1) < y then (s, i+1) else (y, i)
      in (\x1 (x2, y2) -> (x1 + x2, y2)) next $ solve ys (next, j)
    ans = flip map [1..n] $ \i -> let
        (l, r) = splitAt i a
        (v, j) = solve (r++l) (10^9+1, 0)
      in v + x * j
  print $ minimum ans
