#include <bits/stdc++.h>
using namespace std;
const long long maxn = 9223000000000000000;
struct DATA {
  long long v;
  long long c;
  long double p;
};
long long n, l;
DATA data[31];
bool cmp(DATA x, DATA y) { return x.p < y.p; }
void init() {
  scanf("%lld%lld", &n, &l);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &data[i].c);
    data[i].v = pow(2, i - 1);
    data[i].p = (long double)data[i].c / data[i].v;
  }
  sort(data + 1, data + n + 1, cmp);
}
long long process(long long left) {
  long long ans = maxn;
  if (left == 0) return 0;
  for (int i = 1; i <= n; i++) {
    if (data[i].v >= left) ans = min(ans, data[i].c);
  }
  int id = -1;
  for (int i = 1; i <= n; i++)
    if (data[i].v < left) {
      id = i;
      break;
    }
  if (id != -1) {
    long long sum = 0;
    long long k = left / data[id].v;
    sum = k * data[id].c + process(left - k * data[id].v);
    ans = min(ans, sum);
  }
  return ans;
}
int main() {
  init();
  printf("%lld", process(l));
  return 0;
}
