# Original solution
import sys
input = sys.stdin.buffer.readline

# identity element
ide_ele = 10**9+1
 
def main():
    n, x = list(map(int, input().split()))
    A = list(map(int, input().split()))
 
    def segfunc(x, y):
        if x <= y:
          return x
        else:
          return y
 
    def init(init_val):
        # set_val
        for i in range(n):
            seg[i+num-1] = init_val[i]
        # built
        for i in range(num-2, -1, -1):
            seg[i] = segfunc(seg[2*i+1], seg[2*i+2])
 
    def update(k, x):
        k += num - 1
        seg[k] = x
        while k:
            k = (k-1)//2
            seg[k] = segfunc(seg[2*k+1], seg[2*k+2])
 
    def query(p, q):
        if q <= p:
            return ide_ele
        p += num - 1
        q += num - 2
        res = ide_ele
        while q-p>1:
            if p&1 == 0:
                res = segfunc(res, seg[p])
            if q&1 == 1:
                res = segfunc(res, seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = segfunc(res, seg[p])
        else:
            res = segfunc(segfunc(res, seg[p]), seg[q])
        return res
 
    # num: n以上の最小の2のべき乗
    num = 2**(n-1).bit_length()
    seg = [ide_ele]*2*num
 
    init(A)
 
    ans = 10**18
    for k in range(n):
        t = k*x
        for i in range(n):
            if k <= i:
                t += min(query(i-k, i-k//2), query(i-k//2, i+1))
            else:
                temp1 = min(query(0, i//2), query(i//2, i+1))
                temp2 = min(query(n-(k-i), n-(k-i)//2), query(n-(k-i)//2, n))
                if temp1 <= temp2:
                    t += temp1
                else:
                    t += temp2
        if t <= ans:
            ans = t
    print(ans)
 
if __name__ == '__main__':
    main()

# Optimized solution
n, x = list(map(int,input().split()))
A = list(map(int,input().split()))

class SegTree:
    def __init__(self, init_val, ide_ele, segfunc):
        self.n = len(init_val)
        self.num = 2**(self.n-1).bit_length()
        self.ide_ele = ide_ele
        self.segfunc = segfunc
        self.seg = [ide_ele]*2*self.num
        # set_val
        for i in range(self.n):
            self.seg[i+self.num] = init_val[i]
        # built
        for i in range(self.num-1, 0, -1):
            self.seg[i] = self.segfunc(self.seg[2*i], self.seg[2*i+1])

    def update(self, k, x):
        k += self.num
        self.seg[k] = x
        while k:
            k = k >> 1
            self.seg[k] = self.segfunc(self.seg[2*k], self.seg[2*k+1])

    def query(self, l, r):
        if r <= l:
            return self.ide_ele
        l += self.num
        r += self.num
        res = self.ide_ele
        while l < r:
            if r & 1:
                r -= 1
                res = self.segfunc(res, self.seg[r])
            if l & 1:
                res = self.segfunc(res, self.seg[l])
                l += 1
            l = l >> 1
            r = r >> 1
        return res

seg = SegTree(A, 10**18, min)
ans = 10**18
for k in range(n):
    t = k*x
    for i in range(n):
        if k <= i:
            t += seg.query(i-k, i+1)
        else:
            t += min(seg.query(0, i+1), seg.query(n-(k-i), n))
    ans = min(t, ans)
print(ans)