#include <bits/stdc++.h>
using namespace std;
void solve(long long int arr[], long long int n, long long int l) {
  for (int i = 1; i < n; i++) {
    arr[i] = min(arr[i], 2 * arr[i - 1]);
  }
  long long int exp[n];
  for (int i = 0; i < n; i++) {
    exp[i] = 1LL << i;
  }
  long long int ans = LLONG_MAX;
  long long int val = 0;
  for (int i = n - 1; i >= 0; i--) {
    long long int currentAns = val + (l + exp[i] - 1) / exp[i] * arr[i];
    ans = min(ans, currentAns);
    long long int x = l / exp[i];
    l -= x * exp[i];
    val += x * arr[i];
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int n, l;
    cin >> n >> l;
    long long int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    solve(arr, n, l);
  }
}
