Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes of all the colors together.

Snuke can perform the following two actions:

* Select a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.

* Cast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.




Find the minimum time that Snuke needs to have slimes in all N colors.

Constraints

* 2≤N≤2,000
* a_i are integers.
* 1≤a_i≤10^9
* x is an integer.
* 1≤x≤10^9

Input

The input is given from Standard Input in the following format:


N x
a_1 a_2 ... a_N


Output

Find the minimum time that Snuke needs to have slimes in all N colors.

Examples

Input

2 10
1 100


Output

12


Input

3 10
100 1 100


Output

23


Input

4 10
1 2 3 4


Output

10
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args)throws Exception {
		BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
		String[] input1 = br.readLine().split(" ");
		int N = Integer.parseInt(input1[0]);
		int x = Integer.parseInt(input1[1]);
		//[][0]は飼う時間
		//[][1]に　1が入っているとxよりも早く飼える
		//[][2]に　1が入ってると飼っている状態
		//[][3]に　1が入っていると色を変えた
		long [][]slime = new long[N][4];
		int count = 0;
		long total=0;
		long result = 0;
		String []input2 = br.readLine().split(" ");
		for(int j=0;j<N;j++) {
			int i = Integer.parseInt(input2[count]);
			total += i;
			slime[count][0] = i;
			if(i < x) {
				slime[count][1] = 1;
				slime[count][2] = 1;
				result += i;
			}
			count++;
		}
		if(total < x) {
			System.out.println(total);
			return;
		}else {
			while(true) {
				for(int i =N-1 ;i>=0;i--) {
					if(slime[i][3] == 0 ) {
						if(slime[i][2] ==1) {
							if(i+1 < N) {
								slime[i][2] = 0;
								slime[i+1][2] = 1;
								slime[i+1][3] = 1;
							}else{
								slime[i][2] = 0;
								slime[0][2] = 1;
								slime[0][3] = 1;
							}
						}
					}
				}
				result += x;
				for(int i =0 ;i<N;i++) {
					slime[i][3] = 0;
					if(slime[i][1] == 1 && slime[i][2] == 0) {
						slime[i][2] = 1;
						result += slime[i][0];
					}
				}
				int breakco = 0;
				for(int i =0 ;i<N;i++) {
					if(slime[i][2] == 1) {
						breakco++;
					}
				}
				if(breakco == N) {
					break;
				}
			}
			if(result >=total) {
				System.out.println(total);
			}else {
				System.out.println(result);
			}
		}
	}
}