#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, L;
  cin >> n >> L;
  vector<int> c(n);
  for (int i = 0; i < n; i++) cin >> c[i];
  vector<int> inds(n);
  iota(inds.begin(), inds.end(), 0);
  sort(inds.begin(), inds.end(), [&](int a, int b) {
    return ((long double)c[a] / (1 << a)) < ((long double)c[b] / (1 << b));
  });
  ll ans = 0, res = numeric_limits<ll>::max();
  for (int i = 0; i < n && L > 0; i++) {
    int cur = 1 << inds[i];
    if (cur <= L) {
      int times = L / cur;
      ans += 1ll * times * c[inds[i]];
      L -= times * cur;
    }
    res = min(res, ans + c[inds[i]]);
  }
  cout << min(res, ans) << '\n';
  return 0;
}
