#include <bits/stdc++.h>
using namespace std;
const int N = 32;
long long a[N];
int n, l;
int main() {
  cin >> n >> l;
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
    if (i) {
      a[i - 1] = min(a[i - 1], a[i]);
    }
  }
  for (int i = (n); i < (N); ++i) {
    a[i] = a[i - 1] * 2;
  }
  for (int i = (0); i < (N - 1); ++i) {
    a[i + 1] = min(a[i + 1], a[i] * 2);
  }
  long long cur = 0;
  long long ans = 1LL << 62;
  for (int i = N - 1; i >= 0; --i) {
    if (!(l & (1LL << i))) {
      ans = min(ans, cur + a[i]);
    } else {
      cur += a[i];
    }
  }
  ans = min(ans, cur);
  cout << ans << endl;
  return 0;
}
