#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3 + 7;
const ll INF = 1e18;

int a[N], b[N];

int main()
{
	ios::sync_with_stdio(false);

	int n, x;
	cin >> n >> x;
	for (int i=0; i<n; i++)
		cin >> a[i];
	memcpy(b, a, sizeof a);
	ll ans = INF;
	for (int i=0; i<n; i++)
	{
		ll tmp = 0;
		for (int j=0; j<n; j++)
			tmp += a[j];
		ans = min(ans, tmp + 1LL * i * x);
		for (int j=0; j<n; j++)
			a[j] = min(a[j], b[(j + i + 1) % n]);
	}
	cout << ans << "\n";
	return 0;
}