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 sun.reflect.generics.tree.Tree;

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Map.Entry;

public class Template {

    String fileName = "";
    long INF = Long.MAX_VALUE/3;
    int INT_INF = Integer.MAX_VALUE-12341234;
    long MODULO = 1000*1000*1000+7;
    List<Integer>[] graph;
    void solve() throws IOException {
        int n = readInt();
        long l = readInt();

        long[] powsCost = new long[32];
        Arrays.fill(powsCost, INF);
        for(int i=0; i<n; ++i){
            powsCost[i] = readInt();
        }
        for(int i=1; i<32; ++i){
            powsCost[i] = Math.min(powsCost[i-1]*2, powsCost[i]);
        }

        boolean[] powL = new boolean[32];
        long cur = 1<<30;
        int pow = 30;

        while(cur>0){
            if(l>=cur){
                l -= cur;
                powL[pow] = true;
            }
            pow--;
            cur /= 2;
        }

        long[] prefSum = new long[32];
        for(boolean i: powL){
           // out.print(i?1:0);
        }
        for(long i: prefSum){
            //out.println(i);
        }

        if(powL[0]) prefSum[0] = powsCost[0];
        long ans = 0;
        for(int i=1; i<32; ++i){
            prefSum[i] = prefSum[i-1];
            if(powL[i]) prefSum[i] += powsCost[i];
            ans = Math.max(ans, prefSum[i]);
        }

        //out.println("\n"+ans);
        long sum = ans;
        for(int i=n+1; i>0; --i){
            ans = Math.min(ans, sum-prefSum[i-1]+powsCost[i]);
        }

        out.println(ans);
    }


    ////////////////////////////////////////////////////////////
    int gcd(int a, int b){
        return b == 0 ? a : gcd(b, a%b);
     }

    long binPow(long a, long b, long m) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 1) {
            return ((a % m) * (binPow(a, b - 1, m) % m)) % m;
        } else {
            long c = binPow(a, b / 2, m);
            return (c * c) % m;
        }

    }
    class Fenwik {
        long[] t;
        int length;

        Fenwik(int[] a) {
            length = a.length + 100;
            t = new long[length];

            for (int i = 0; i < a.length; ++i) {
                inc(i, a[i]);
            }
        }

        void inc(int ind, int delta) {
            for (; ind < length; ind = ind | (ind + 1)) {
                t[ind] += delta;
            }
        }

        long getSum(int r) {
            long sum = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                sum += t[r];
            }
            return sum;
        }
    }

    class SegmentTree {
        int[] t;

        SegmentTree(int[] a) {
            int n = a.length - 1;
            t = new int[n * 4];
            build(a, 1, 1, n);
        }

        void build(int[] a, int v, int tl, int tr) {
            if (tl == tr) {
                t[v] = a[tl];
                return;
            }

            int mid = (tr + tl) / 2;

            build(a, 2 * v, tl, mid);
            build(a, 2 * v + 1, mid + 1, tr);

            t[v] = Math.max(t[2 * v], t[2 * v + 1]);
        }

        void update(int v, int tl, int tr, int pos, int value) {
            if (tl == tr) {
                t[v] = value;
                return;
            }

            int mid = (tl + tr) / 2;

            if (pos <= mid) {
                update(2 * v, tl, mid, pos, value);
            } else {
                update(2 * v + 1, mid + 1, tr, pos, value);
            }

            t[v] = Math.max(t[2 * v], t[2 * v + 1]);
        }

        int getMax(int v, int tl, int tr, int l, int r) {
            if (l > r) {
                return -1000 * 1000;
            }
            if (tl == tr) {
                return t[v];
            }

            if (l == tl && r == tr) {
                return t[v];
            }

            int mid = (tl + tr) / 2;

            int max1 = getMax(2 * v, tl, mid, l, Math.min(mid, r));
            int max2 = getMax(2 * v + 1, mid + 1, tr, Math.max(mid + 1, l), r);

            return Math.max(max1, max2);
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        // TODO Auto-generated method stub
        new Template().run();
    }

    void run() throws NumberFormatException, IOException {
        solve();
        out.close();
    };

    BufferedReader in;
    PrintWriter out;

    StringTokenizer tok;
    String delim = " ";
    Random rnd = new Random();

    Template() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }

        }
        tok = new StringTokenizer("");
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (null == nextLine) {
                return null;
            }

            tok = new StringTokenizer(nextLine);
        }
        return tok.nextToken();
    }

    int readInt() throws NumberFormatException, IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws NumberFormatException, IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(readString());
    }
}
