from itertools import accumulate as acc

N, x, *A = list(map(int, open(0).read().split()))

dp = []

for i in range(N):

  dp.append(list(acc((A[(i-j)%N] for j in range(N)),min)))



ans = 10**60

for i,a in enumerate(zip(*dp)):

  ans = min(ans,i*x+sum(a))

print(ans)

from itertools import accumulate

from functools import reduce

N,x,*A = list(map(int, open(0).read().split()))

dp = [0]*N

for i in range(N):

  dp[i] = list(accumulate((A[i-j] for j in range(N)),min))

ans = reduce(min, (i*x+sum(a) for i,a in enumerate(zip(*dp))))

print(ans)
from itertools import accumulate as acc

N, x, *A = list(map(int, open(0).read().split()))
dp = []
for i in range(N):
    dp.append(list(acc((A[(i - j) % N] for j in range(N)), min)))
ans = 10**60
for i, a in enumerate(zip(*dp)):
    ans = min(ans, i * x + sum(a))
print(ans)

from itertools import accumulate
from functools import reduce

N, x, *A = list(map(int, open(0).read().split()))
dp = [0] * N
for i in range(N):
    dp[i] = list(accumulate((A[i - j] for j in range(N)), min))
ans = reduce(min, (i * x + sum(a) for i, a in enumerate(zip(*dp))))
print(ans)

-from itertools import accumulate as acc +from itertools import accumulate +from functools import reduce -dp = [] +dp = [0] * N -    dp.append(list(acc((A[(i - j) % N] for j in range(N)), min))) -ans = 10**60 -for i, a in enumerate(zip(*dp)): -    ans = min(ans, i * x + sum(a)) +    dp[i] = list(accumulate((A[i - j] for j in range(N)), min)) +ans = reduce(min, (i * x + sum(a) for i, a in enumerate(zip(*dp))))