import Data.List( sortBy, subsequences, foldl')
import Data.Function( on)
import Data.Array.IArray( Array, listArray, (!))
import qualified Data.Array.IArray as A
import Data.IntSet( lookupGE, IntSet, map, elems, delete
		    , fromList, null)
import qualified Data.IntSet as S
import Data.Map( Map, (!), map, empty, insert)
import qualified Data.Map as M
import Control.Applicative( (<$>))
main = do
    [n,x] <- return . (read <$>) . words =<< getLine
    as <- return . (read <$>) . words =<< getLine
    let cost = listArray (1,n) as::Array Int Int
	iniSet = fromList [1..n]

	magic::IntSet -> IntSet
	magic = S.map shift
	  where
	    shift k = if k==1 then n else k-1
	minFrom:: IntSet -> Integer
	minFrom =
	    let minMem::Map IntSet Integer
		minMem = foldl' (\m s->insert s (zenka s) m)
				    M.empty powSet
		powSet = S.fromList <$> subsequences [1..n] 
		zenka::IntSet->Integer
		zenka toEllim
		  | S.null toEllim  = 0
		  | otherwise =
		      let bruteforce = do
			    (c,st) <- zip ((fromIntegral x*) <$> [0..]) $
					take n$iterate magic toEllim
			    e <- elems st
			    return $ c + fromIntegral ((A.!) cost e)
					+ minFrom (delete e st)
		      in minimum bruteforce
	    in (M.!) minMem
    print $ minFrom iniSet