#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2005;

int a[MAXN], n, x;
int f[MAXN][MAXN];

int main()
{
	scanf("%d%d", &n, &x);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	long long ans = 1e18;
	for (int i = 0; i < n; i++) {
		f[i][0] = a[i];
		for (int j = 1; j < n; j++)
			f[i][j] = min(f[i][j-1], a[(i-j+n)%n]);
	}
	for (int i = 0; i < n; i++) {
		long long cur = (long long)x*i;
		for (int j = 0; j < n; j++)
			cur += f[j][i];
		ans = min(ans, cur);
	}
	cout << ans << endl;
	return 0;
}
