import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



"""

・変色の回数を決め打つ

・どの色として捕獲しておくべきだったかが決まる

・左とのminをとることで遷移

"""



import numpy as np



N,X = list(map(int,readline().split()))

A = np.array(read().split(),np.int64)



INF = 10 ** 18

answer = INF

for change in range(N+100):

    x = A.sum() + change * X

    if answer > x:

        answer = x

    x = min(A[0],A[-1])

    A[1:] = np.minimum(A[:-1],A[1:])

    A[0] = x



print(answer)
import sys

import numpy as np



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



N, X = list(map(int, readline().split()))

A = np.array(read().split(), np.int64)



INF = 10**18

dp = np.full((N, N + N), INF, np.int64)

dp[0] = np.concatenate((A, A))

for n in range(1, N):

    dp[n, 1:] = np.minimum(dp[n - 1, 1:], dp[n - 1, :-1])

dp = dp[:, N:]



x = dp.sum(axis=1) + X * np.arange(N)

print((x.min()))
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・変色の回数を決め打つ
・どの色として捕獲しておくべきだったかが決まる
・左とのminをとることで遷移
"""
import numpy as np

N, X = list(map(int, readline().split()))
A = np.array(read().split(), np.int64)
INF = 10**18
answer = INF
for change in range(N + 100):
    x = A.sum() + change * X
    if answer > x:
        answer = x
    x = min(A[0], A[-1])
    A[1:] = np.minimum(A[:-1], A[1:])
    A[0] = x
print(answer)

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, X = list(map(int, readline().split()))
A = np.array(read().split(), np.int64)
INF = 10**18
dp = np.full((N, N + N), INF, np.int64)
dp[0] = np.concatenate((A, A))
for n in range(1, N):
    dp[n, 1:] = np.minimum(dp[n - 1, 1:], dp[n - 1, :-1])
dp = dp[:, N:]
x = dp.sum(axis=1) + X * np.arange(N)
print((x.min()))

+import numpy as np -""" -・変色の回数を決め打つ -・どの色として捕獲しておくべきだったかが決まる -・左とのminをとることで遷移 -""" -import numpy as np - -answer = INF -for change in range(N + 100): -    x = A.sum() + change * X -    if answer > x: -        answer = x -    x = min(A[0], A[-1]) -    A[1:] = np.minimum(A[:-1], A[1:]) -    A[0] = x -print(answer) +dp = np.full((N, N + N), INF, np.int64) +dp[0] = np.concatenate((A, A)) +for n in range(1, N): +    dp[n, 1:] = np.minimum(dp[n - 1, 1:], dp[n - 1, :-1]) +dp = dp[:, N:] +x = dp.sum(axis=1) + X * np.arange(N) +print((x.min()))