#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
int dr2[] = {0, 0, 1, -1};
int dc2[] = {1, -1, 0, 0};
using namespace std;
long long int a[32];
long long int cal(long long int x, long long int l1) {
  long long int i;
  if (l1 == 0) return 0;
  bool f = 0;
  for (i = x - 1; i >= 0; i--) {
    long long int p = (1 << x) / (1 << i);
    if (a[i] * p < a[x]) {
      f = 1;
      break;
    }
  }
  if (f == 1) return cal(x - 1, l1);
  long long int po = (1 << x);
  long long int k = l1 / po;
  long long int baki = l1 % po;
  long long int r1 = cal(x - 1, baki);
  long long int r2 = k * a[x];
  long long int r3 = min(r1, a[x]);
  return r3 + r2;
}
int main() {
  long long int n, l, i;
  while (cin >> n >> l) {
    for (long long int i = 0; i < n; i++) cin >> a[i];
    long long int ans = cal(n - 1, l);
    cout << ans << endl;
  }
  return 0;
}
