#include <iostream>
#define ll long long
using namespace std;

int main()
{
  int N, X;
  cin>>N>>X;
  ll a[N];
  ll mn[N];
  for(int i=0; i<N; i++)
  {
    cin>>a[i];
    mn[i] = -1;
  }

  ll answ = -1;
  for(int k=0; k<N; k++)
  {
    ll tot = (ll)X * k; //provo a prendere tutti i possibili k

    for(int i=0; i<N; i++)
    {
      if(mn[i] == -1 || a[(i-k+N)%N] < mn[i])
       mn[i] = a[(i-k+N)%N];
      tot += mn[i];
    }

    if(answ == -1 || tot < answ) answ = tot;
  }

  cout<<answ;
  return 0;
}
