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