#include <bits/stdc++.h>
using namespace std;
long long n,x,a[2010],b[2010],ans,tmp;
int main(){
    scanf("%lld%lld",&n,&x);
    for(int i=0;i<n;i++)scanf("%lld",&a[i]);
    ans=1e14;memset(b,0x3f,sizeof(b));
	for(int i=0;i<n;i++){
        tmp=0;for(int j=1;j<=n;j++)b[j]=min(b[j],a[(j-i+n)%n]),tmp+=b[j];
        ans=min(ans,i*x+tmp);
    }printf("%lld\n",ans);
}