#include<bits/stdc++.h>
using namespace std;

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

struct segmentTree{

    int N;
    vector< pair<long long, int> > mini, maxi;
    vector<long long> sum;
    const long long INF = 2e18;
    
    void init(int siz){
        N = 1;
        while(N < siz){
            N <<= 1;
        }
        mini.resize(N * 2 - 1, {INF, -1});
        maxi.resize(N * 2 - 1, {-INF, -1});
        sum.resize(N * 2 - 1);
        return;
    }

    void build(vector<long long> &dat){
        init(dat.size());
        for(int i = 0, len = dat.size() ; i < len ; ++i){
            mini[i + N - 1] = {dat[i], i};
            maxi[i + N - 1] = {dat[i], i};
            sum[i + N - 1] = dat[i];
        }
        for(int i = N - 2 ; i >= 0 ; --i){
            mini[i] = min(mini[i * 2 + 1], mini[i * 2 + 2]);
            maxi[i] = max(maxi[i * 2 + 1], maxi[i * 2 + 2]);
            sum[i] = sum[i * 2 + 1] + sum[i * 2 + 2];
        }
    }

    void update(int k, long long x){
        k += N - 1;
        mini[k].first = x;
        maxi[k].first = x;
        sum[k] = x;
        while(k > 0){
            k = (k - 1) / 2;
            mini[k] = min(mini[k * 2 + 1], mini[k * 2 + 2]);
            maxi[k] = max(maxi[k * 2 + 1], maxi[k * 2 + 2]);
            sum[k] = sum[k * 2 + 1] + sum[k * 2 + 2];
        }
    }

    pair<long long, int> getMin(int a, int b, int k, int l, int r){
        if(r <= a || b <= l){
            return {INF, -1};
        }
        if(a <= l && r <= b){
            return mini[k];
        }
        pair<long long, int> vl = getMin(a, b, k * 2 + 1, l, (l + r) / 2);
        pair<long long, int> vr = getMin(a, b, k * 2 + 2, (l + r) / 2, r);
        return min(vl, vr);
    }

    pair<long long, int> getMin(int a, int b){
        return getMin(a, b, 0, 0, N);
    }

    pair<long long, int> getMax(int a, int b, int k, int l, int r){
        if(r <= a || b <= l){
            return {-INF, -1};
        }
        if(a <= l && r <= b){
            return maxi[k];
        }
        pair<long long, int> vl = getMax(a, b, k * 2 + 1, l, (l + r) / 2);
        pair<long long, int> vr = getMax(a, b, k * 2 + 2, (l + r) / 2, r);
        return max(vl, vr);
    }

    pair<long long, int> getMax(int a, int b){
        return getMax(a, b, 0, 0, N);
    }

    long long getSum(int a, int b, int k, int l, int r){
        if(r <= a || b <= l){
            return 0LL;
        }
        if(a <= l && r <= b){
            return sum[k];
        }
        long long vl = getSum(a, b, k * 2 + 1, l, (l + r) / 2);
        long long vr = getSum(a, b, k * 2 + 2, (l + r) / 2, r);
        return vl + vr;
    }

    long long getSum(int a, int b){
        return getSum(a, b, 0, 0, N);
    }

};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    lint n, x;
    cin >> n >> x;

    vector<lint> a(n * 2);
    rep(i, n){
        cin >> a[i];
        a[n + i] = a[i];
    }

    segmentTree seg;
    seg.build(a);

    lint ans = LLINF;
    rep(i, n){
        lint tmp = (lint)i * x;
        REP(j, n, n * 2){
            tmp += seg.getMin(j - i, j + 1).first;
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 768