#include <bits/stdc++.h>
using namespace std;
long long n, L;
long long c[35];
signed main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> L;
  for (long long i = 0; i < n; ++i) {
    cin >> c[i];
  }
  for (long long i = 1; i < 30; ++i) {
    if (c[i])
      c[i] = min(c[i], c[i - 1] * 2);
    else
      c[i] = c[i - 1] * 2;
  }
  long long ans = LLONG_MAX;
  long long sum = 0;
  for (long long i = 29; i >= 0; --i) {
    long long need = L / (1ll << i);
    sum += need * c[i];
    L -= need << i;
    ans = min(ans, sum + (L > 0) * c[i]);
  }
  cout << ans;
}
