import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void times(alias pred)(int n) {
    foreach(i; 0..n) pred();
}
auto rep(alias pred, T = typeof(pred()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = pred();
    return res;
}

long INF = long.max/3;
void main() {
    int N;
    long x;
    readf("%d %d\n", &N, &x);
    long[] a = readln.split.to!(long[]);

    int[][] ary = new int[][](N, N);
    foreach(i; 0..N) {
        ary[i][] = -1;
        long s = 0;
        long m = INF;
        foreach(j; 0..N) {
            long t = a[(N+i-j)%N]+s;
            if (t < m) {
                m = t;
                ary[i][j] = j;
            }
            if (ary[i][j] < 0) ary[i][j] = ary[i][j-1];
            s += x;
        }
    }

    long ans = INF;
    foreach(t; 0..N) {
        long s = 0;
        foreach(i; 0..N) {
            s += a[(N+i-ary[i][t])%$];
        }
        ans = min(ans, s+t*x);
    }
    ans.writeln;
}
