Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together.

Snuke can perform the following two actions:

* Select a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.

* Cast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.




Find the minimum time that Snuke needs to have slimes in all N colors.

Constraints

* 2≤N≤2,000
* a_i are integers.
* 1≤a_i≤10^9
* x is an integer.
* 1≤x≤10^9

Input

The input is given from Standard Input in the following format:


N x
a_1 a_2 ... a_N


Output

Find the minimum time that Snuke needs to have slimes in all N colors.

Examples

Input

2 10
1 100


Output

12


Input

3 10
100 1 100


Output

23


Input

4 10
1 2 3 4


Output

10
#include <bits/stdc++.h>
using namespace std;
const long double EPS = (long double)1e-7;
const long double PI = acos(0) * 2;
bool isZero(const long double& x) { return abs(x) <= EPS; }
int sign(const long double& x) { return isZero(x) ? 0 : (0 < x ? 1 : -1); }
long long gcd(long long a, long long b) {
  for (; b; a %= b, swap(a, b)) {
  }
  return abs(a);
}
pair<long long, long long> operator+(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return pair<long long, long long>(a.first + b.first, a.second + b.second);
}
pair<long long, long long> operator-(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return pair<long long, long long>(a.first - b.first, a.second - b.second);
}
pair<long long, long long> operator*(const pair<long long, long long>& a,
                                     const long long& b) {
  return pair<long long, long long>(a.first * b, a.second * b);
}
long long operator*(const pair<long long, long long>& a,
                    const pair<long long, long long>& b) {
  return a.first * b.second - b.first * a.second;
}
long long ccw(const pair<long long, long long>& a,
              const pair<long long, long long>& b,
              const pair<long long, long long>& c) {
  return a * b + b * c + c * a;
}
int rd(int s, int e) { return rand() % (e - s + 1) + s; }
void fg(vector<int> G[], int a, int b) {
  G[a].push_back(b);
  G[b].push_back(a);
}
void fg(vector<pair<int, int> > G[], int a, int b, int c) {
  G[a].push_back({b, c});
  G[b].push_back({a, c});
}
const int MAXN = 2005;
long long dp[MAXN];
long long A[MAXN];
long long Ans = (0x3f3f3f3f3f3f3f3fll);
int N;
long long X;
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> X;
  for (int i = 1; i <= N; i++) cin >> A[i];
  rotate(A + 1, min_element(A + 1, A + N + 1), A + N + 1);
  Ans = 0;
  for (int i = 1; i <= N; i++) Ans += A[i];
  for (int t = 2; t <= N; t++) {
    fill(dp, dp + N + 1, (0x3f3f3f3f3f3f3f3fll));
    dp[0] = 0;
    for (int i = 1; i <= N; i++) {
      for (int j = max(1, i - t + 1); j <= i; j++)
        (dp[i]) = min((dp[i]), (dp[j - 1] + A[j] * (i - j + 1)));
    }
    (Ans) = min((Ans), (dp[N] + X * (t - 1)));
  }
  cout << Ans << endl;
  return 0;
}
