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

A = list(map(int, input().split()))[::-1]*2

B = A[:n]

ans = float("inf")

for k in range(n):

  t = x*k + sum(B)

  ans = min(ans, t)

  for j in range(n):

    B[j] = min(B[j], A[j+k+1])

print(ans)
import numpy as np

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

A = np.array(input().split()[::-1]*2, dtype=np.int64)

B = A.copy()[:n]

ans = float("inf")

for k in range(n):

  t = x*k + B.sum()

  ans = min(ans, t)

  np.minimum(B, A[k+1:k+n+1], out=B)

print(ans)
n, x = list(map(int, input().split()))
A = list(map(int, input().split()))[::-1] * 2
B = A[:n]
ans = float("inf")
for k in range(n):
    t = x * k + sum(B)
    ans = min(ans, t)
    for j in range(n):
        B[j] = min(B[j], A[j + k + 1])
print(ans)

import numpy as np

n, x = list(map(int, input().split()))
A = np.array(input().split()[::-1] * 2, dtype=np.int64)
B = A.copy()[:n]
ans = float("inf")
for k in range(n):
    t = x * k + B.sum()
    ans = min(ans, t)
    np.minimum(B, A[k + 1 : k + n + 1], out=B)
print(ans)

+import numpy as np + -A = list(map(int, input().split()))[::-1] * 2 -B = A[:n] +A = np.array(input().split()[::-1] * 2, dtype=np.int64) +B = A.copy()[:n] -    t = x * k + sum(B) +    t = x * k + B.sum() -    for j in range(n): -        B[j] = min(B[j], A[j + k + 1]) +    np.minimum(B, A[k + 1 : k + n + 1], out=B)