import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
 
auto solve(string s_)
{
    auto Nx = s_.split.map!(to!long)();
    immutable N=Nx[0], x=Nx[1];
    auto as = readln.split.map!(to!long).array();
    long m=sum(as);
    foreach(k;1..N)
    {
        auto dp = new long[N];
        foreach(i;0..N) dp[i]=min(as[i],as[(i-1+N)%N]);
        m=min(m,sum(dp)+x*k);
        swap(dp,as);
    }
    return m;
}

void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }