#include <iostream>
using namespace std;

long long n, x;
long long a[5000];

const long long inf = 1e18;

int main()
{
  cin >> n >> x;
  for (int i = 0; i < n; i++){
    cin >> a[i];
    a[i + n] = a[i];
  }

  long long ans = inf;
  for (int i = 0; i < n; i++){
    long long c = 0;
    for (int j = n; j < 2 * n; j++){
      long long po = inf;
      for (int k = 0; k <= i; k++){
        po = min(po, a[j - k]);
      }
      c += po;
    }

    ans = min(ans, c + i * x);
  }

  cout << ans << endl;
}
