N, x = list(map(int, input().split()))

A = list(map(int, input().split()))

A += A

INF = 10 ** 18

ans = INF

B = [INF] * N

for cnt in range(N):

    for i in range(N):

        B[i] = min(B[i], A[N + i - cnt])

    ans = min(ans, cnt * x + sum(B))



print(ans)
import numpy as np

N, x = list(map(int, input().split()))

A = list(map(int, input().split()))

A += A

A = np.array(A, int)

INF = 10 ** 18

ans = INF

B = np.ones(N, int) * INF

for cnt in range(N):

    np.minimum(A[N-cnt:2*N-cnt], B, B)

    ans = min(ans, cnt * x + np.sum(B))



print(ans)
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A += A
INF = 10**18
ans = INF
B = [INF] * N
for cnt in range(N):
    for i in range(N):
        B[i] = min(B[i], A[N + i - cnt])
    ans = min(ans, cnt * x + sum(B))
print(ans)

import numpy as np

N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A += A
A = np.array(A, int)
INF = 10**18
ans = INF
B = np.ones(N, int) * INF
for cnt in range(N):
    np.minimum(A[N - cnt : 2 * N - cnt], B, B)
    ans = min(ans, cnt * x + np.sum(B))
print(ans)

+import numpy as np + +A = np.array(A, int) -B = [INF] * N +B = np.ones(N, int) * INF -    for i in range(N): -        B[i] = min(B[i], A[N + i - cnt]) -    ans = min(ans, cnt * x + sum(B)) +    np.minimum(A[N - cnt : 2 * N - cnt], B, B) +    ans = min(ans, cnt * x + np.sum(B))