#include <bits/stdc++.h>
using namespace std;
long long c[40];
int main() {
  int n, L;
  cin >> n >> L;
  for (int i = 0; i <= 30; i++) c[i] = (1LL << 62);
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    for (int j = i; j <= 30; j++) c[j] = min(c[j], x * (1 << (j - i)));
  }
  long long ans = (1LL << 62);
  int st = 0;
  for (int i = 0; i <= 30; i++) {
    if ((1 << i) <= L)
      st = i;
    else {
      ans = min(ans, c[i]);
    }
  }
  long long tmp = 0;
  for (int i = st; i >= 0; i--) {
    tmp += L / (1 << i) * c[i];
    ans = min(ans, tmp + (L % (1 << i) ? c[i] : 0));
    L %= (1 << i);
  }
  cout << ans << endl;
  return 0;
}
