#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, l;
  cin >> n >> l;
  long long a[n];
  long long pow[32];
  pow[0] = 1;
  for (long long i = 1; i <= 31; i++) pow[i] = 2 * pow[i - 1];
  for (long long i = 0; i <= n - 1; i++) {
    cin >> a[i];
    if (i != 0) a[i] = min(a[i], 2 * a[i - 1]);
  }
  long long ans = 4e18;
  long long sum = 0;
  for (long long i = n - 1; i >= 0; i--) {
    long long need = l / pow[i];
    sum += need * a[i];
    l %= pow[i];
    if (l > 0)
      ans = min(ans, sum + a[i]);
    else
      ans = min(ans, sum);
  }
  cout << ans;
}
