#include <bits/stdc++.h>
using namespace std;
int n;
long long l, c[30];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> l;
  for (int i = (0); i < (n); ++i) {
    cin >> c[i];
    if (i > 0) c[i] = min(c[i], c[i - 1] << 1);
  }
  long long ans = 1.1e18, sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    sum += (c[i] * (l / (1 << i)));
    l %= (1 << i);
    ans = min(ans, sum + (l != 0) * c[i]);
  }
  cout << ans << endl;
  return 0;
}
