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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sumit
 */
public class Main {
      public static void main(String[] args) {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            OutputWriter out = new OutputWriter(outputStream);
            CPartyLemonade solver = new CPartyLemonade();
            solver.solve(1, in, out);
            out.close();
      }

      static class CPartyLemonade {
            String Binary(int l, int n) {
                  StringBuilder str = new StringBuilder();
                  while (l > 0) {
                        if (l % 2 == 0) {
                              str.append('0');
                        } else
                              str.append('1');
                        l = l >> 1;
                  }
                  while (n - str.length() > 0)
                        str.append('0');
                  str.append('0');
                  str.append('0');
                  return str.toString();

            }

            long fn(int i) {
                  long ans = 1;
                  while (i > 0) {
                        ans = ans << 1;
                        i--;
                  }
                  return ans;
            }

            public void solve(int testNumber, InputReader in, OutputWriter out) {
                  int n = in.nextInt();
                  int l = in.nextInt();
                  int arr[] = in.nextIntArray(n);
                  for (int i = 1; i < n; i++) {
                        arr[i] = Math.min(arr[i], 2 * arr[i - 1]);
                  }

                  String allo = Binary(l, n);
                  long ct[] = new long[allo.length()];
                  Arrays.fill(ct, Long.MAX_VALUE);
                  for (int i = 0; i < allo.length(); i++) {
                        if (i < n && allo.charAt(i) == '0') {
                              if (i > 0)
                                    ct[i] = Math.min(ct[i - 1], arr[i]);
                              else
                                    ct[i] = 0;
                        } else if (i < n && allo.charAt(i) == '1') {
                              if (i > 0)
                                    ct[i] = arr[i] + ct[i - 1];
                              else
                                    ct[i] = arr[i];
                        } else if (i >= n) {
                              if (allo.charAt(i) == '0') {
                                    long mm = Long.MAX_VALUE;
                                    for (int j = 0; j < n; j++) {
                                          mm = Math.min(fn(i - j) * arr[j], mm);
                                    }
                                    ct[i] = Math.min(ct[i - 1], mm);
                              } else {
                                    long mm = Long.MAX_VALUE;
                                    for (int j = 0; j < n; j++) {
                                          mm = Math.min(fn(i - j) * arr[j], mm);
                                    }
                                    ct[i] = ct[i - 1] + mm;
                              }
                        }
                  }


                  out.printLine(ct[allo.length() - 1]);


            }

      }

      static class InputReader {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;

            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 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 & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return res * sgn;
            }

            public int[] nextIntArray(int arraySize) {
                  int array[] = new int[arraySize];

                  for (int i = 0; i < arraySize; i++)
                        array[i] = nextInt();

                  return array;
            }

            public boolean isSpaceChar(int c) {
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

      }

      static class OutputWriter {
            private final PrintWriter writer;

            public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
            }

            public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
            }

            public void close() {
                  writer.close();
            }

            public void printLine(long i) {
                  writer.println(i);
            }

      }
}

