A New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemonade has already become a pleasant necessity.

Your favorite store sells lemonade in bottles of n different volumes at different costs. A single bottle of type i has volume 2i - 1 liters and costs ci roubles. The number of bottles of each type in the store can be considered infinite.

You want to buy at least L liters of lemonade. How many roubles do you have to spend?

Input

The first line contains two integers n and L (1 ≤ n ≤ 30; 1 ≤ L ≤ 109) — the number of types of bottles in the store and the required amount of lemonade in liters, respectively.

The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 109) — the costs of bottles of different types.

Output

Output a single integer — the smallest number of roubles you have to pay in order to buy at least L liters of lemonade.

Examples

Input

4 12
20 30 70 90


Output

150


Input

4 3
10000 1000 100 10


Output

10


Input

4 3
10 100 1000 10000


Output

30


Input

5 787787787
123456789 234567890 345678901 456789012 987654321


Output

44981600785557577

Note

In the first example you should buy one 8-liter bottle for 90 roubles and two 2-liter bottles for 30 roubles each. In total you'll get 12 liters of lemonade for just 150 roubles.

In the second example, even though you need only 3 liters, it's cheaper to buy a single 8-liter bottle for 10 roubles.

In the third example it's best to buy three 1-liter bottles for 10 roubles each, getting three liters for 30 roubles.
/* Author-Meet Shah
/*
* uncomment this if you want to read input.
import java.io.BufferedReader;
import java.io.InputStreamReader;
*/
import java.util.*;
import java.io.*;
public class Test {
private static InputStream stream;
private static byte[] buf=new byte[1024];
private static int curChar;
private static int numChars;
private static PrintWriter pw;
static long min=Long.MAX_VALUE;
private static SpaceCharFilter filter;
public static void main(String args[] ) throws Exception
{
InputReader(System.in);
pw=new PrintWriter(System.out);
soln();
pw.close();
}
public static void soln()
{

    Scanner sc= new Scanner(System.in);
//-------------My Code------------------------------
    
    
    int n=nextInt();
int l= nextInt();
int array[]=new int[n];
array = nextIntArray(n);
long current=0;
long ans=0;
LinkedList<Long>ln=new LinkedList<>();
while (current<l){
    long min=Long.MAX_VALUE;
    long maxpow=-1;
    for(int i=0,j=1;i<n&&j<=(l-current);i++,j*=2)maxpow=j;
    long maxpow1=((l-current)/maxpow);
    for(int i=0,j=1;i<n;i++,j*=2){
        if(j<=maxpow){
            min=Math.min(min,maxpow1*(maxpow/j)*array[i]);
        }else{
            ln.add(ans+array[i]);
        }
    }
    current+=(maxpow1)*maxpow;
    ans+=min;
}
for(int i=0;i<ln.size();i++)ans=Math.min(ans,ln.get(i));
pw.println(ans);
    
//-------------------------------------------------
}                                                                                            
    public static double angle(double x, double y){
  return Math.toDegrees(Math.atan2(y, x));
 }

static long modulo(long a,long b,long c) {
  long x=1;
  long y=a;
  while(b > 0){
   if(b%2 == 1){
    x=(x*y)%c;
   }
   y = (y*y)%c; // squaring the base
   b /= 2;
  }
  return  x%c;
 }
 static long gcd(long x, long y)
 {
  if(x==0)
   return y;
  if(y==0)
   return x;
  long r=0, a, b;
  a = (x > y) ? x : y; // a is greater number
  b = (x < y) ? x : y; // b is smaller number
  r = b;
  while(a % b != 0)
  {
   r = a % b;
   a = b;
   b = r;
  }
  return r;
 }
public static void InputReader(InputStream stream1) {
stream = stream1;
}

private static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}

private static boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}

private static int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}

private static int nextInt() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}

private static long nextLong() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}

private static String nextToken() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}

private static String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isEndOfLine(c));
return res.toString();
}

private static int[] nextIntArray(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}

private static long[] nextLongArray(int n) {
long[] arr = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = nextLong();
}
return arr;
}

private static void pArray(int[] arr){
for (int i=0; i<arr.length; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
return;
}

private static void pArray(long[] arr){
for (int i=0; i<arr.length; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
return;
}

private static boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return isWhitespace(c);
}

private interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}

}
