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

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

b = a[:]

a = a + a

ans = 10 ** 18

for i in range(n):

    for j in range(n):

        if b[j] > a[j+n-i]:

            b[j] = a[j+n-i]

    t = sum(b) + x * i

    if ans > t:

        ans = t

print(ans)

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

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

ans = 10 ** 18

for i in range(n):

    t = sum(a) + x * i

    if ans > t:

        ans = t

    t = a[-1]

    for j in range(n - 1, 0, -1):

        if a[j] > a[j-1]:

            a[j] = a[j-1]

    if a[0] > t:

        a[0] = t

print(ans)

n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a[:]
a = a + a
ans = 10**18
for i in range(n):
    for j in range(n):
        if b[j] > a[j + n - i]:
            b[j] = a[j + n - i]
    t = sum(b) + x * i
    if ans > t:
        ans = t
print(ans)

n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10**18
for i in range(n):
    t = sum(a) + x * i
    if ans > t:
        ans = t
    t = a[-1]
    for j in range(n - 1, 0, -1):
        if a[j] > a[j - 1]:
            a[j] = a[j - 1]
    if a[0] > t:
        a[0] = t
print(ans)

-b = a[:] -a = a + a -    for j in range(n): -        if b[j] > a[j + n - i]: -            b[j] = a[j + n - i] -    t = sum(b) + x * i +    t = sum(a) + x * i +    t = a[-1] +    for j in range(n - 1, 0, -1): +        if a[j] > a[j - 1]: +            a[j] = a[j - 1] +    if a[0] > t: +        a[0] = t