#include<bits/stdc++.h>
#define F(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;typedef long long ll;
int n,x;
int a[2001],b[2001];
ll Ans;
int main(){
	scanf("%d%d",&n,&x);
	F(i,1,n) scanf("%d",a+i), Ans+=a[i], b[i]=a[i];
	F(i,1,n-1){
		ll sum=0;
		swap(a,b);
		F(j,1,n) b[j]=min(b[j],a[(j+n-2)%n+1]), sum+=b[j];
		Ans=min(Ans,sum+(ll)i*x);
	} printf("%lld",Ans);
	return 0;
}