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

main :: IO ()
main = do
  [n, x] <- map read . words <$> getLine
  a <- listArray (0, n-1) . map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
  let
    b pre k = if k == n-1
      then sum pre + k * x
      else let
          next = array (0, n-1) $ map (\(i, e) -> (i, min e (a ! ((i-k-1)`mod`n)))) $ assocs pre
        in min (sum pre + k * x) $ b next (k+1)
  print $ b a 0
