n,x,*a=list(map(int,open(0).read().split()));i,m=0,1e18;exec('m=min(m,sum(a)+x*i);i+=1;a=[min(t)for t in zip(a,a[-1:]+a)];'*n);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()))
i, m = 0, 1e18
exec("m=min(m,sum(a)+x*i);i+=1;a=[min(t)for t in zip(a,a[-1:]+a)];" * n)
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)

-i, m = 0, 1e18 -exec("m=min(m,sum(a)+x*i);i+=1;a=[min(t)for t in zip(a,a[-1:]+a)];" * n) +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)]