#include<cstdio>
int a[2005],n;
long long ans=200000000000000ll,x,tmp,mn[2005];
long long Min(long long x,long long y){return x<y?x:y;}
int main()
{
	scanf("%d%lld",&n,&x);
	for(int i=1;i<=n;++i)scanf("%d",a+i),mn[i]=200000000000000ll;
	for(int i=0;i<n;++i){
		tmp=x*i;
		for(int j=1;j<=n;++j)mn[j]=Min(mn[j],a[(j-1-i+n)%n+1]),tmp+=mn[j];
		ans=Min(ans,tmp);
	}
	printf("%lld\n",ans);
	return 0;
}