#include <bits/stdc++.h>
using namespace std;

int n;
long long x,a[2010],b[2010][2010],ans=2e17,res;
int main()
{
	scanf("%d%lld",&n,&x);
	for(int i=0;i<=n-1;++i)
	scanf("%lld",&a[i]);
	for(int i=0;i<=n-1;++i)
	{
		b[0][i]=a[i];
		res+=a[i];
	}
	ans=min(ans,res);
	for(int k=1;k<=n-1;++k)
	{
		res=0;
		for(int i=0;i<=n-1;++i)
		{
			b[k][i]=min(b[k-1][i],a[(i-k+n)%n]);
			res+=b[k][i];
		}
		res+=x*k;
		ans=min(ans,res);
	}
	printf("%lld\n",ans);
	return 0;
}