# -*- coding: utf-8 -*-

def inpl(): return list(map(int, input().split()))

N, x = inpl()

A = inpl()

ans = sum(A)



for i in range(1, N):

    A = [min(A[j], A[(j-1)%N]) for j in range(N)]

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



print(ans)
from collections import Counter

def inpl(): return list(map(int, input().split()))

N, x = inpl()

A = inpl()

B = [a for a in A]



ans = 1e15

for i in range(N+1):

    for j in range(N):

        B[j] = min(B[j], A[(j-i)%N])

    tmp = x*i + sum(B)

    ans = min(ans, tmp)

print(ans)

# -*- coding: utf-8 -*-
def inpl():
    return list(map(int, input().split()))


N, x = inpl()
A = inpl()
ans = sum(A)
for i in range(1, N):
    A = [min(A[j], A[(j - 1) % N]) for j in range(N)]
    ans = min(ans, sum(A) + x * i)
print(ans)

from collections import Counter


def inpl():
    return list(map(int, input().split()))


N, x = inpl()
A = inpl()
B = [a for a in A]
ans = 1e15
for i in range(N + 1):
    for j in range(N):
        B[j] = min(B[j], A[(j - i) % N])
    tmp = x * i + sum(B)
    ans = min(ans, tmp)
print(ans)

-# -*- coding: utf-8 -*- +from collections import Counter + + -ans = sum(A) -for i in range(1, N): -    A = [min(A[j], A[(j - 1) % N]) for j in range(N)] -    ans = min(ans, sum(A) + x * i) +B = [a for a in A] +ans = 1e15 +for i in range(N + 1): +    for j in range(N): +        B[j] = min(B[j], A[(j - i) % N]) +    tmp = x * i + sum(B) +    ans = min(ans, tmp)