#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, i, m, q, mx = INT_MIN, mn = INT_MAX, k, c = 0, j, d = 0,
                            t = 0, sm = 0, pdt = 1;
  cin >> n;
  long long int v[n + 1];
  cin >> m;
  for (i = 1; i <= n; i++) {
    cin >> v[i];
    if (i != 1) {
      v[i] = min(2 * v[i - 1], v[i]);
    }
  }
  for (i = n; i >= 1; i--) {
    d = pow(2, i - 1);
    c = m / d;
    t += c * v[i];
    if (i == n) {
      if (m % d == 0) {
        mn = t;
      } else {
        mn = t + v[i];
        ;
      }
    } else {
      if (m % d == 0) {
        mn = min(mn, t);
      } else {
        mn = min(mn, t + v[i]);
      }
    }
    m -= c * pow(2, i - 1);
  }
  cout << mn << endl;
  return;
}
int main() {
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
