#include <bits/stdc++.h>
using namespace std;
long long expo(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a;
    a = a * a;
    b /= 2;
  }
  return res;
}
int main() {
  int n, i, len, j;
  long long L, temp;
  cin >> n >> L;
  temp = L;
  vector<long long> c(n);
  for (i = 0; i < n; i++) cin >> c[i];
  string s = "";
  while (temp) {
    s += ('0' + temp % 2);
    temp /= 2;
  }
  for (i = 1; i < n; i++) {
    c[i] = min(c[i], 2 * c[i - 1]);
  }
  reverse(s.begin(), s.end());
  len = s.size();
  long long ans = 1e18, need, sum = 0;
  temp = L;
  for (i = n - 1; i >= 0; i--) {
    need = (temp / expo(2, i));
    sum += need * c[i];
    temp -= (need * expo(2, i));
    ans = min(ans, sum + (temp > 0) * c[i]);
  }
  ans = min(ans, sum);
  for (i = 0; i < len; i++) {
    if (s[i] == '1') {
      ans = min(ans, sum);
    } else {
      temp = L;
      temp += expo(2, i);
      long long sum2 = 0;
      for (j = n - 1; j >= 0; j--) {
        need = (temp / expo(2, j));
        sum2 += need * c[j];
        temp -= (need * expo(2, j));
      }
      ans = min(ans, sum2);
    }
  }
  cout << ans << '\n';
}
