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

using ll = long long;

ll A[2010];
ll T[2010];

int main(){
    ll N, x;
    cin >> N >> x;
    ll ans = 0;
    for(ll i=0; i<N; i++){
        cin >> A[i];
        T[i] = A[i];
        ans += T[i];
    }

    for(ll p=1; p<N; p++){
        ll sum = p * x;
        for(ll i=0; i<N; i++){
            T[i] = min(T[i], A[(i-p+N)%N]);
            sum += T[i];
        }
        ans = min(ans, sum);
    }
    cout << ans << endl; 
    return 0;
}
