#include<iostream>
#include<algorithm>
#include<vector>
#define LL long long
#define PP std::pair<LL,LL>
int N;
LL a[5010];
LL d[5010];
LL x;
LL ans = 1000000000000000000;
int main() {
	std::cin >> N >> x;
	for (int i = 1; i <= N; i++) {
		std::cin >> a[i];
		a[i + N] = a[i];
		d[i] = 1 << 30;
	}
	for (int i = 0; i <= N; i++) {
		LL sum = i * x;
		for (int j = 1; j <= N; j++) {
			d[j] = std::min(d[j], a[j + N - i]);
			sum += d[j];
		}
		ans = std::min(ans, sum);
	}
	std::cout << ans << std::endl;
	return 0;
}