// Original C++ solution (slower):
#include <iostream>

#include <sstream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <ctime>

#include <cstring>

#include <string>

#include <vector>

#include <stack>

#include <queue>

#include <deque>

#include <map>

#include <set>

#include <bitset>

#include <numeric>

#include <utility>

#include <iomanip>

#include <algorithm>

#include <functional>

using namespace std;



#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)



template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)

{ return s << '<' << P.first << ", " << P.second << '>'; }

template<class T> ostream& operator << (ostream &s, vector<T> P)

{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }

template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)

{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)

{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }





int N;

long long x;

vector<int> vec;



const int MAX_S = 5000;

struct SparseTable {

    static const int LOG_MAX_S = 14;

    int st[LOG_MAX_S][MAX_S*2];

    int ln[MAX_S];

    

    void init(const vector<int> &vec) {

        for (int i = 0; i < MAX_S; ++i) {

            st[0][i] = 1<<30;

            int ti = i, tln = 0;

            while (ti > 0) ti /= 2, ++tln;

            ln[i] = tln - 1;

        }

        for (int i = 0; i < vec.size(); ++i) st[0][i] = vec[i];

        for (int i = 1; i < LOG_MAX_S; ++i) {

            for (int j = 0; j < MAX_S; ++j) {

                st[i][j] = min(st[i-1][j], st[i-1][j + (1<<(i-1))]);

            }

        }

    }

    

    // [a, b)

    int get(int a, int b) {

        if (a >= b) return 1<<30;

        int bet = b - a, row = ln[bet];

        return min(st[row][a], st[row][b - (1<<row)]);

    }

    

} st;



long long solve() {

    long long res = 1LL<<59;

    st.init(vec);

    

    for (int con = 0; con < N; ++con) {

        long long tmp = x * con;

        for (int i = 0; i < N; ++i) {

            int Min = 1<<30;

            if (con <= i) chmin(Min, st.get(i-con, i+1));

            else {

                chmin(Min, st.get(0, i+1));

                chmin(Min, st.get(N-(con-i), N));

            }

            //cout << con << ", " << i << ": " << Min << endl;

            tmp += Min;

        }

        //cout << tmp << endl << endl;

        chmin(res, tmp);

    }

    return res;

}



int main() {

    while (cin >> N >> x) {

        vec.clear();

        for (int i = 0; i < N; ++i) {

            int a; cin >> a;

            vec.push_back(a);

        }

        cout << solve() << endl;

    }

}








// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)

{ return s << '<' << P.first << ", " << P.second << '>'; }

template<class T> ostream& operator << (ostream &s, vector<T> P)

{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }

template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)

{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

template<class T> ostream& operator << (ostream &s, set<T> P)

{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }

template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)

{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }





const long long INF = 1LL<<60;

int N;

long long X;

vector<long long> A;



long long solve() {

    long long res = INF;

    for (int i = 0; i < N; ++i) A.push_back(A[i]);

    vector<long long> bmin(N, INF);

    for (int k = 0; k < N; ++k) {

        long long tmp = 0;

        for (int i = 0; i < N; ++i) {

            chmin(bmin[i], A[i+k]);

            tmp += bmin[i];

        }

        chmin(res, tmp + X*k);



/*

        COUT("------------------");

        COUT(k);

        COUT(bmin);

        COUT(tmp);

        */

    }

    return res;

}



int main() {

    while (cin >> N >> X) {

        A.resize(N);

        for (int i = 0; i < N; ++i) cin >> A[i];

        cout << solve() << endl;

    }

}


// Fastest known solution for this problem: