#include "bits/stdc++.h"

using namespace std;

void solve()
{
	int n;
	long x;
	cin >> n >> x;
	vector<long> as(n);
	long ans = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> as[i];
		ans += as[i];
	}

	for (int i = 1; i < n; i++)
	{
		long tmp = i*x;
		vector<long> bs = as;
		for (int j = 0; j < n; j++)
		{
			bs[j] = min(bs[j], as[(j-1+n)%n]);
			tmp += bs[j];
		}
		ans = min(ans, tmp);
		swap(as, bs);
	}
	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}
