#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int a[2005], mn[2005], idx[2005];
int main(){
	int n, x;
	scanf("%d%d", &n, &x);
	for(int i=1;i<=n;i++){
		scanf("%d", &a[i]);
		idx[i] = i;
		mn[i] = a[i];
	}
	LL ans = 1e18;
	for(int i=0;i<=n-1;i++){
		LL res = (LL)i*x;
		for(int j=1;j<=n;j++){
			mn[j] = min(mn[j], a[idx[j]]);
			res += mn[j];
			idx[j]--;
			if(idx[j] == 0) idx[j] = n;
		}
		ans = min(ans, res);
	}
	printf("%lld\n", ans);
}