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

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

s_cost = a.copy()

cost = sum(s_cost)

for k in range(1,N):

    for i in range(N):

        if s_cost[i] > a[(i-k)%N] :

            s_cost[i] = a[(i-k)%N]

    if cost > k*x + sum(s_cost):

        cost = k*x + sum(s_cost)

    else:

        break



print(cost)



def solve_():

    import itertools

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

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

    s_cost = a.copy()

    cost = sum(s_cost)



    for k, i in itertools.product(list(range(1, N)), list(range(N))):

        s_cost[i] = a[(i - k) % N] if s_cost[i] > a[(i - k) % N] else s_cost[i]

        if i == N - 1 and cost > k*x + sum(s_cost):

            cost = k*x + sum(s_cost)



    print(cost)



solve_()
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
s_cost = a.copy()
cost = sum(s_cost)
for k in range(1, N):
    for i in range(N):
        if s_cost[i] > a[(i - k) % N]:
            s_cost[i] = a[(i - k) % N]
    if cost > k * x + sum(s_cost):
        cost = k * x + sum(s_cost)
    else:
        break
print(cost)

def solve_():
    import itertools

    N, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    s_cost = a.copy()
    cost = sum(s_cost)
    for k, i in itertools.product(list(range(1, N)), list(range(N))):
        s_cost[i] = a[(i - k) % N] if s_cost[i] > a[(i - k) % N] else s_cost[i]
        if i == N - 1 and cost > k * x + sum(s_cost):
            cost = k * x + sum(s_cost)
    print(cost)


solve_()

-N, x = list(map(int, input().split())) -a = list(map(int, input().split())) -s_cost = a.copy() -cost = sum(s_cost) -for k in range(1, N): -    for i in range(N): -        if s_cost[i] > a[(i - k) % N]: -            s_cost[i] = a[(i - k) % N] -    if cost > k * x + sum(s_cost): -        cost = k * x + sum(s_cost) -    else: -        break -print(cost) +def solve_(): +    import itertools + +    N, x = list(map(int, input().split())) +    a = list(map(int, input().split())) +    s_cost = a.copy() +    cost = sum(s_cost) +    for k, i in itertools.product(list(range(1, N)), list(range(N))): +        s_cost[i] = a[(i - k) % N] if s_cost[i] > a[(i - k) % N] else s_cost[i] +        if i == N - 1 and cost > k * x + sum(s_cost): +            cost = k * x + sum(s_cost) +    print(cost) + + +solve_()