import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n, x;
    scan(n, x);
    auto a = readln.split.to!(int[]);

    long ans = inf6;

    auto deq = Deque!(int)(n);

    foreach (k ; 0 .. n) {
        long t = 1L * k * x;

        deq.clear();
        foreach (i ; 0 .. k + 1) {
            while (!deq.empty && a[deq.back] >= a[i]) {
                deq.popBack();
            }
            deq.pushBack(i);
        }

        t += a[deq.front];

        foreach (i ; k + 1 .. n + k) {
            while (!deq.empty && (deq.front % n) < i - k) {
                deq.popFront();
            }
            while (!deq.empty && a[(deq.back) % n] >= a[i % n]) {
                deq.popBack();
            }
            deq.pushBack(i);
            t += a[deq.front % n];
        }

        ans = min(ans, t);
    }

    writeln(ans);
}


struct Deque(T) {
    private {
        int N, head, tail;
        T[] deq;
    }

    this(int n) {
        N = n + 1;
        deq = new T[](N + 1);
    }

    void clear() {
        head = tail;
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return head == ((tail + 1) % N);
    }

    int length() {
        return (tail - head + N) % N;
    }

    T front() {
        assert(!empty);
        return deq[head];
    }

    T back() {
        assert(!empty);
        return deq[(tail - 1 + N) % N];
    }

    void pushFront(T x) {
        assert(!full);
        head = (head - 1 + N) % N;
        deq[head] = x;
    }

    void pushBack(T x) {
        assert(!full);
        deq[tail++] = x;
        tail %= N;
    }

    void popFront() {
        assert(!empty);
        head = (head + 1) % N;
    }

    void popBack() {
        assert(!empty);
        tail = (tail - 1 + N) % N;
    }

    alias insert = pushBack;
    alias removeFront = popFront;
    alias removeBack = popBack;

    T opIndex(size_t index)
    in {
        assert(0 <= index && index < length);
    }
    body {
        return deq[(head + index) % N];
    }

    alias opDollar = length;
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
