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.

import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;

import java.util.InputMismatchException;

public class Q3 {
public static void main(String[] args){
 InputReader in=new InputReader(System.in);
 PrintWriter pw=new PrintWriter(System.out);
 int n=in.readInt();
 long l=in.readLong();

 Integer[] c=new Integer[n];
 for(int i=0;i<n;i++){
	c[i] = in.readInt();
 }
 long cur=0;
 long ans=0;
 
 LinkedList<Long> ln=new LinkedList<>();
 
 while (cur<l){
     long min=Long.MAX_VALUE;
     long maxb=-1;
     for(int i=0 , j=1; i<n && j<=(l-cur); i++, j*=2) {
    	 maxb=j;
     }
     long maxpow1=((l-cur)/maxb);
     
     for(int i=0,j=1;i<n;i++,j*=2){
         if(j<=maxb){
             min=Math.min(min,maxpow1*(maxb/j)*c[i]);
         }
         else{
             ln.add(ans+c[i]);
         }
     }
     cur+=(maxpow1)*maxb;
     ans+=min;
 }
 for(int i=0;i<ln.size();i++) {
	 ans=Math.min(ans,ln.get(i));
 }
 	pw.println(ans);
 pw.close();
 
}
static int fib(int n)
{
int F[][] = new int[][]{{1,1},{1,0}};
if (n == 0)
    return 0;
power(F, n-1);
  
return F[0][0];
}
  
static void multiply(int F[][], int M[][])
{
int x =  F[0][0]*M[0][0] + F[0][1]*M[1][0];
int y =  F[0][0]*M[0][1] + F[0][1]*M[1][1];
int z =  F[1][0]*M[0][0] + F[1][1]*M[1][0];
int w =  F[1][0]*M[0][1] + F[1][1]*M[1][1];
 
F[0][0] = x;
F[0][1] = y;
F[1][0] = z;
F[1][1] = w;
}
  
/* Optimized version of power() in method 4 */
static void power(int F[][], int n)
{
if( n == 0 || n == 1)
  return;
int M[][] = new int[][]{{1,1},{1,0}};
  
power(F, n/2);
multiply(F, F);
  
if (n%2 != 0)
   multiply(F, M);
}
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;
}
static class Pair implements Comparable<Pair>{
	int x,y;
	Pair(int xx,int yy){
		x=xx;y=yy;
	}
	@Override
	public int compareTo(Pair o) {
		if(Integer.compare(o.y, this.y)==0){
			return Integer.compare(this.x, o.x);
		}
		else{
			return Integer.compare(this.y, o.y);
		}
	}
}
static  class InputReader
{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;
 
    public InputReader(InputStream stream)
    {
        this.stream = stream;
    }
 
    public 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++];
    }
 
    public int readInt()
    {
        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;
    }
 
    public String readString()
    {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do
        {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }
    public String readLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }
    
 
    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }
    public long readLong() {
        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;
    }
    public boolean isSpaceChar(int c)
    {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
 
    public String next()
    {
        return readString();
    }
 
    public interface SpaceCharFilter
    {
        public boolean isSpaceChar(int ch);
    }
    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }
}
}