n,x,*a=list(map(int,open(0).read().split()))

m=1e18

for i in range(n):m=min(m,sum(a)+x*i);a=[min(t)for t in zip(a,a[-1:]+a)]

print(m)
n,x,*a=list(map(int,open(0).read().split()))

m=1e18

for i in range(n):m=min(m,sum(a)+x*i);*a,=list(map(min,list(zip(a,a[-1:]+a))))

print(m)
n, x, *a = list(map(int, open(0).read().split()))
m = 1e18
for i in range(n):
    m = min(m, sum(a) + x * i)
    a = [min(t) for t in zip(a, a[-1:] + a)]
print(m)

n, x, *a = list(map(int, open(0).read().split()))
m = 1e18
for i in range(n):
    m = min(m, sum(a) + x * i)
    (*a,) = list(map(min, list(zip(a, a[-1:] + a))))
print(m)

-    a = [min(t) for t in zip(a, a[-1:] + a)] +    (*a,) = list(map(min, list(zip(a, a[-1:] + a))))