#include <bits/stdc++.h>
using namespace std;
int n;
long long X, ans, a[2005], mi[2005][2005];
int main() {
  scanf("%d%lld", &n, &X);
  for (register int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  for (register int i = 1; i <= n; ++i) {
    mi[i][i] = a[i];
    for (register int j = i + 1; j <= n; ++j)
      mi[i][j] = min(mi[i][j - 1], a[j]);
  }
  for (register int i = 0; i < n; ++i) {
    long long kl = 1LL * i * X;
    for (register int j = 1; j <= n; ++j) {
      int t = j - i;
      if (t >= 1)
        kl += mi[t][j];
      else
        kl += min(mi[1][j], mi[t + n][n]);
    }
    if (i == 0 || kl < ans) ans = kl;
  }
  printf("%lld\n", ans);
  return 0;
}
