// 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.3030342502167045x):
#include<cstdio>

#include<algorithm>

using namespace std;



#define MAXN 2000

int N,X;

int Cost[MAXN+5],Change[MAXN+5][MAXN+5];



int main(){

    scanf("%d%d",&N,&X);

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

        scanf("%d",Cost+i);

    long long Ans=1ll<<60,tot=0;

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

        tot+=Change[i][0]=Cost[i];

    Ans=min(Ans,tot);

    for(int k=1;k<N;k++){

        tot=0;

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

            tot+=Change[i][k]=min(Change[i][k-1],Cost[i-k<1?N+i-k:i-k]);

        Ans=min(Ans,1ll*k*X+tot);

    }

    printf("%lld",Ans);

}