// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



#define fRead(x)        freopen(x,"r",stdin)

#define fWrite(x)       freopen (x,"w",stdout)



#define LL              long long

#define ULL             unsigned long long

#define ff              first

#define ss              second

#define pb              push_back

#define INF             5e13

#define PI              acos(-1.0)

#define mk              make_pair

#define pii             pair<int,int>

#define pll             pair<LL,LL>

#define all(a)          a.begin(),a.end()

#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())



#define min3(a,b,c)     min(a,min(b,c))

#define max3(a,b,c)     max(a,max(b,c))

#define min4(a,b,c,d)   min(a,min(b,min(c,d)))

#define max4(a,b,c,d)   max(a,max(b,max(c,d)))

#define SQR(a)          ((a)*(a))

#define FOR(i,a,b)      for(int i=a;i<=b;i++)

#define ROF(i,a,b)      for(int i=a;i>=b;i--)

#define REP(i,b)        for(int i=0;i<b;i++)

#define MEM(a,x)        memset(a,x,sizeof(a))

#define ABS(x)          ((x)<0?-(x):(x))



#define SORT(v)         sort(v.begin(),v.end())

#define REV(v)          reverse(v.begin(),v.end())



#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

LL ara[2004];

LL tree[10005];



void update(LL at,LL L,LL R,LL pos,LL val)

{

    if(pos<L or R<pos)return;



    if(pos==L and pos==R)

    {

        tree[at] = val;

        return;

    }



    LL mid = (L+R)/2;

    update(2*at,L,mid,pos,val);

    update(2*at+1,mid+1,R,pos,val);

    tree[at]=min(tree[2*at],tree[2*at+1]);

}



LL query(LL at,LL L,LL R,LL l,LL r)

{

    if(l > r)return 1e18;

    if(r<L or R<l)return 1e18;

    if(l<=L and R<=r)return tree[at];



    LL mid = (L+R)/2;

    LL x = query(2*at,L,mid,l,r);

    LL y = query(2*at+1,mid+1,R,l,r);



    return min(x,y);

}



LL n,x;

inline LL check(LL r)

{

   int bam = - r;

   LL ans = 0;

   for(int i  = 0 ; i < n;i++,bam++){

      LL mn = ara[i];

      int pos = ((bam%n) + n)%n;

      if(pos > i)

      {

         mn = min(mn, query(1,0,n-1,pos,n-1));

         mn = min(mn, query(1,0,n-1,0,i-1));

      }else{

         mn = min(mn, query(1,0,n-1,pos,i-1));

      }

      ans += mn;

   }



   ans = ans + x * r;

   return ans;

}

int main()

{

   FastRead

   cin >> n >> x;



   for(int i = 0;i < n;i++){

      cin >> ara[i];

      update(1,0,n-1,i,ara[i]);

   }



   LL lo = 0, hi = n - 1;

   while(hi - lo > 3)

   {

      LL m1 = (hi-lo)/3 + lo;

      LL m2 = (hi-lo)/3 + m1;

      if(check(m1) > check(m2)){

         lo = m1;

      }else{

         hi = m2;

      }

//      cout << lo << " " << hi << endl;

   }

   LL ans = 4e18;

   for(int i = lo;i<=hi;i++){

//      cout << i << " " << check(i) << endl;

      ans = min(ans,check(i));

   }

   cout << ans << "\n";





}


// Faster C++ solution for the same problem (measured speedup: 5.302092122913005x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

#define MAXN 2005

#define LL long long

LL n,x;

LL a[MAXN],dp[MAXN][MAXN];

int main()

{

	LL ans=1LL<<60LL;

	scanf("%lld %lld",&n,&x);

	for(int i=1;i<=n;i++)

	{

		scanf("%lld",&a[i]);

		dp[i][0]=a[i];

	}

	for(int i=1;i<=n;i++)

		for(int j=1;j<=n-1;j++)

		{

			int pos=i-j;

			if(pos<=0) pos=n+pos;

			dp[i][j]=min(dp[i][j-1],a[pos]);

		}

	for(int j=0;j<n;j++)

	{

		LL sum=0;

		for(int i=1;i<=n;i++)

			sum+=dp[i][j];

		ans=min(ans,sum+x*j);//x必须要开long long 否则x和j都是int 乘起来要爆掉的

	}

	printf("%lld\n",ans);

}