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.util.*;

public class Main {


    void solve() throws IOException {
        int n = readInt();
        int L = readInt();
        int[] c = readIntArray(n);
        long answer = Long.MAX_VALUE;
        long[] pow2 = new long[32];
        pow2[0] = 1;
        for (int i = 1; i < 32; i++) pow2[i] = 2 * pow2[i - 1];
        int maxByte = 0;
        for (int i = 0; i < 32; i++)
            if (pow2[i] >= L) {
                maxByte = i;
                break;
            }
        for (int i = maxByte; i < n; i++) answer = minLong(answer, c[i]);
        cost = new long[32];
        cost[0] = c[0];
        for (int i = 1; i < 32; i++) {
            cost[i] = Long.MAX_VALUE;
            if (i < n) cost[i] = c[i];
            for (int j = 0; j < minInt(i, n); j++) cost[i] = minLong(cost[i], cost[j] * pow2[i - j]);
        }
        long ost = L;
        long preans = 0;
        int [] byteArray = new int [32];
        for (int i =0;i<32;i++){
            byteArray[i]=L%2;
            L/=2;
        }
        for (int i = 31; i >=0; i--) {
            if (byteArray[i] == 1) {
                preans += cost[i];
            } else {
                answer = minLong(preans + cost[i], answer);
            }
        }
        out.println(minLong(preans, answer));
    }

    long[] cost;


    int checkBit(int mask, int bit) {
        return (mask >> bit) & 1;
    }

    public static void main(String[] args) throws IOException {

        new Main().run();
    }

    boolean isLower(char a) {
        return ((int) a) >= 97 ? true : false;
    }

    int INF = Integer.MAX_VALUE / 10;

    int[][] STEPS = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;
    Random rnd = new Random();
    static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    Main() throws FileNotFoundException {

        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        tok = new StringTokenizer("");
    }

    long checkBit(long mask, int bit) {
        return (mask >> bit) & 1;
    }

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

    char varChar;
    int varInt, varInt1, varInt2;
    long varLong;

    long sqrt(long m) {
        long l = 0;
        long r = m;
        long answer = 0;
        long mid = 0;
        while (l <= r) {
            mid = (l + r) / 2;
            if (mid * mid <= m) {
                answer = mid;
                l = mid + 1;
            } else r = mid - 1;
        }
        return answer;
    }

    int countPow(int m, int n) {
        varInt = 0;
        while (m % n == 0 && m > 0) {
            varInt++;
            m /= n;
        }
        return varInt;
    }

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

    }

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

    long pow(long x, long k) {
        varLong = 1;
        for (int i = 0; i < k; ++i) {
            varLong *= x;
        }
        return varLong;
    }

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

        Fenwik(int[] a) {
            this.length = a.length + 100;
            this.t = new long[length];
            for (int i = 0; i < a.length; ++i) {
                this.inc(i, a[i]);
            }
        }

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

        long getSum(int r) {
            long sum = 0;

            for (; r >= 0; r = (r & (r + 1)) - 1) {
                sum += this.t[r];
            }

            return sum;
        }

    }

    // ////////////////////////////////////////////////////////////////////

    String delimiter = " ";

    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(delimiter);
    }

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

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

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

    int[] readIntArray(int b) {
        int a[] = new int[b];
        for (int i = 0; i < b; i++) {
            try {
                a[i] = readInt();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return a;
    }

    int[] readSortedIntArray(int size) throws IOException {
        Integer[] array = new Integer[size];

        for (int index = 0; index < size; ++index) {
            array[index] = readInt();
        }
        Arrays.sort(array);

        int[] sortedArray = new int[size];
        for (int index = 0; index < size; ++index) {
            sortedArray[index] = array[index];
        }

        return sortedArray;
    }

    int[] sortedIntArray(int size, int[] array) throws IOException {
        for (int index = 0; index < size; ++index) {
            array[index] = readInt();
        }
        Arrays.sort(array);

        int[] sortedArray = new int[size];
        for (int index = 0; index < size; ++index) {
            sortedArray[index] = array[index];
        }

        return sortedArray;
    }

    int minInt(int... values) {
        int min = Integer.MAX_VALUE;
        for (int value : values) {
            min = Math.min(min, value);
        }
        return min;
    }

    int maxInt(int... values) {
        int max = Integer.MIN_VALUE;
        for (int value : values) {
            max = Math.max(max, value);
        }
        return max;
    }

    long minLong(long... values) {
        long min = Long.MAX_VALUE;
        for (long value : values) {
            min = Math.min(min, value);
        }
        return min;
    }

    long maxLong(long... values) {
        long max = Long.MIN_VALUE;
        for (long value : values) {
            max = Math.max(max, value);
        }
        return max;
    }

    boolean checkIndex(int index, int size) {
        return (0 <= index && index < size);
    }

    int abs(int a) {
        return Math.abs(a);
    }
}