//
/*
ID: kfoozmi1
LANG: C++
TASK:
*/
#include <bits/stdc++.h>
using namespace std;

#ifdef kfoozminus
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu() {
	cerr << endl;
}

template <typename T>
void faltu(T a[], int n) {
	for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename First, typename ... hello>
void faltu(First arg, const hello&... rest) {
	cerr << arg << ' ';
	faltu(rest...);
}
#else
#define dbg(args...)
#endif

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define SQR(a) ((a) * (a))
#define vsort(v) sort(v.begin(), v.end())
#define PQ priority_queue
#define PI acos(-1)
#define EPS 1e-9

#define B1 43
#define B2 43

#define MOD1 1000000007
#define MOD2 1000000009
#define MOD  1000000007

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

//int dx[] = {0, 0, +1, -1};
//int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool checkBit(ll n, int i) { return n & (1LL << i); }
inline ll setBit(ll n, int i) { return n | (1LL << i); }
inline ll resetBit(ll n, int i) { return n & (~ (1LL << i)); }
inline bool EQ(double a, double b) { return fabs(a-b) < EPS; }
inline double dist(double ix, double iy, double jx, double jy) { return sqrt(SQR(ix - jx) + SQR(iy - jy)); }

#define PMX 1000000

int marked[PMX/64+2];

#define mark(x) marked[x>>6] |= (1<<((x&63)>>1))
#define check(x) (marked[x>>6] & (1<<((x&63)>>1)))

bool isPrime(int x)
{
    return (x>1) && ((x==2) || ((x&1) && (!(check(x)))));
}

void seive(int n)
{
    int i, j;
    for(i=3; i*i<=n; i+=2)
    {
        if(!check(i))
        {
            for(j=i*i; j<=n; j+=i<<1)
            {
                mark(j);
            }
        }
    }
}

ll bigMod(ll a, ll b)
{
	ll r = 1;
	while(b) {
		if(b & 1) (r *= a) %= MOD;
		b >>= 1;
		(a *= a) %= MOD;
	}
	return r;
}

#define INF 50000000000000000LL
#define MX 2007

ll a[MX], t[4 * MX];

void build(int nd, int tl, int tr)
{
	if(tl == tr) {

		t[nd] = a[tl];
		return ;
	}

	int tm = (tl + tr) >> 1;
	int lc = nd << 1;
	int rc = lc | 1;

	build(lc, tl, tm);
	build(rc, tm + 1, tr);

	t[nd] = min(t[lc], t[rc]);;
}

ll query(int nd, int tl, int tr, int l, int r)
{
	dbg(tl, tr, l, r);
	if(tl >= l && tr <= r) return t[nd];

	int tm = (tl + tr) >> 1;
	int lc = nd << 1;
	int rc = lc | 1;

	if(r <= tm) return query(lc, tl, tm, l, r);
	else if(l > tm) return query(rc, tm + 1, tr, l, r);
	else return min(query(lc, tl, tm, l, r), query(rc, tm + 1, tr, l, r));
}

int main()
{
#ifdef kfoozminus
	//freopen("in", "r", stdin);
#endif
	int n, i, k;
	ll x, ans, mn = INF;

	scanf("%d %lld", &n, &x);
	for(i = 0; i < n; i ++) scanf("%lld", &a[i]);
	build(1, 0, n - 1);
	for(k = 0; k < n; k ++) {
		ans = 0;
		for(i = 0; i < n; i ++) {
			
			dbg(k, i);
			int l = i - k;
			if(l >= 0) ans += query(1, 0, n - 1, l, i);
			else {

				ans += min( query(1, 0, n - 1, 0, i), query(1, 0, n - 1, n + l, n - 1));
			}
		}
		ans += k * x;
		mn = min(mn, ans);
	}
	printf("%lld\n", mn);
	/*for(i = 0; i < n; i ++) {

		mn = INF;
		for(j = i, k = 0; ; j --, k ++) {

			if(j == -1) j = n - 1;

			if(mn > k * x + a[j]) {

				mn = k * x + a[j];
				mna = a[j];
			}

			if(i == n - 1 && j == 0) break;
			if(j == i + 1) break;
		}
		mnk = min(mnk, mn)
	}*/
        return 0;
}


Measured memory_bytes: 256