import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int n;
	long x;
	{
		long[] tmp = readln.chomp.split.map!(to!long).array;
		n = cast(int) tmp[0];
		x = tmp[1];
		}
	long[] as = readln.chomp.split.map!(to!long).array;
	
	long[][] qs;
	qs.length = n;
	for(int i = 0; i < n; i ++){
		for(int k = 0; k < n; k ++){
			int j = i - k;
			if(j < 0) j += n;
			long u = as[j];
			if(qs[i].length && qs[i][$ - 1] < u) u = qs[i][$ - 1];
			qs[i] ~= u;
			}
		}
	
		long ans = long.max;
	for(int k = 0; k < n; k ++){
		long a = x * k;
		foreach(q; qs){
			a += q[k];
			}
		ans = min(ans, a);
		}
	
	ans.writeln;
	}