#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long l;
  cin >> n >> l;
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  for (int i = 1; i < n; ++i) {
    c[i] = min(c[i], 2 * c[i - 1]);
  }
  long long ans = 2e18;
  long long sum = 0;
  for (int i = n - 1; i >= 0; --i) {
    long long need = l / (1 << i);
    sum += need * c[i];
    l -= need * (1 << i);
    ans = min(ans, sum + (0 < l) * c[i]);
  }
  cout << ans << endl;
  return 0;
}
