#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>

#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
// #define iter(a) __typeof(a.begin())
#define FOR(it, a) for (auto it = a.begin(); it != a.end(); ++it)
#define F first
#define S second
#define SZ(a) static_cast<int>((a).size())
#define sz(a) SZ(a)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).begin(), (a).end()
using namespace std;

typedef int64_t ll;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef uint64_t ull;

#ifdef ONLINE_JUDGE
#define PR(...) (void(0))
#else
#define PR(...) \
  do { cerr << "line : " << __LINE__ << ", " << endl;  \
    pr(#__VA_ARGS__, __VA_ARGS__); } while (0)

template<class T>
void pr(const string& name, T t) {
  cerr << name << ": " << t << endl;
}
template<typename T, typename ... Types>
void pr(const string& names, T t, Types ... rest) {
  auto p = names.find(',');
  cerr << names.substr(0, p) << ": " << t << ", ";
  pr(string(names, p + 1), rest ...);
}
#endif

template<class T, class U> ostream& operator<<(
    ostream& o, const pair<T, U>& v) {
  return o << "(" << v.F << ", " << v.S << ")";
}
template<class T> ostream& operator<<(
    ostream& o, const vector<T>& v) {
  o << "{"; rep(i, SZ(v)) o << (i?", ":"") << v[i]; return o << "}"; }
template<class T, class U> ostream& operator<<(
    ostream& o, const map<T, U>& v) {
  o << "{"; for (const auto& e : v) o << e << ", "; return o << "}"; }
template<class T, class U> ostream& operator<<(
    ostream& o, const unordered_map<T, U>& v) {
  o << "{"; for (const auto& e : v) o << e << ", "; return o << "}"; }
template<class T> ostream& operator<<(ostream& o, const set<T>& v) {
  o << "{"; for (const auto& e : v) o << e << ", "; return o << "}"; }
template<class T> string to_s(const T& v) {
  ostringstream is; is << v; return is.str(); }

const int dx[]={0, 1,  0, -1,  1, 1, -1, -1, 0};
const int dy[]={1, 0, -1,  0, -1, 1,  1, -1, 0};

#define endl '\n'


template<class T = int>
struct SparseTable{
  /*
    verified
    SRM 621 DIV1 HARD
    http://ideone.com/CAitn7

    Codeforces #278 DIV1 B
    http://codeforces.com/contest/487/submission/8903740
   */

  vector<T> in;
  vector<vector<T> > table;
  SparseTable(){};
  SparseTable(const vector<T>& arr): in(arr){
    int n = SZ(in);
    table.push_back(in);
    int tnum = 0;
    for(int i = 1; i <= n; i*=2){
      vector<T> ctable;
      for(int j = 0; j+i < SZ(table[tnum]); ++j)
        ctable.pb(max(table[tnum][j], table[tnum][j+i]));
      table.pb(ctable);
      ++tnum;
    }
  }

  T get(int a){
    return in[a];
  }

  T get(int a, int b){
    if(a >= b) return numeric_limits<T>::min();
    int highest = 32 - __builtin_clz(b-a) - 1;
    return max(table[highest][a],table[highest][b-(1<<highest)]);
  }
};

int main(int argc, char *argv[])
{
  int n;
  ll x;
  cin >> n >> x;
  vector<ll> in(n);
  rep(i, n) cin >> in[i];
  ll ans = accumulate(ALL(in), 0LL);
  rep(i, n) in.pb(in[i]);
  for(auto& a : in) a = -a;
  SparseTable<ll> sp(in);

  rep(i, n) {
    ll sum = i * x;
    rep(j, n) {
      sum += -sp.get(j, i + j + 1);
    }
    ans = min(sum, ans);
  }

  cout << ans << endl;
}


Measured memory_bytes: 640