#include<bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  LL N, x;
  cin >> N >> x;
  vector<LL> a(N);
  for(auto& i: a) cin >> i;
  auto b = a;
  LL res = 1e18;
  for(auto i = 0; i < N; ++i) {
    auto sum = x*i;
    for(auto j = 0; j < N; ++j) sum += (b[j] = min(b[j], a[(j-i+N)%N]));
    res = min(res, sum);
  }
  cout << res << endl;
}
