#include <bits/stdc++.h>
using namespace std;
long long cost = INT_MAX;
long long n, l;
long long c[30];
map<long long, long long> mpp;
void retcost(long long lft, long long cc) {
  if (mpp.find(lft) == mpp.end()) {
    mpp[lft] = cc;
    if (lft <= 0) {
      cost = min(cc, cost);
      return;
    }
    for (long long i = 0, k = 1; i < n; i++) {
      if (lft / k == 0)
        retcost(lft - k, cc + c[i]);
      else
        retcost(lft - (lft / k) * k, cc + (lft / k) * c[i]);
      k *= 2;
    }
  } else if (cc < mpp[lft]) {
    mpp[lft] = cc;
    if (lft <= 0) {
      cost = min(cc, cost);
      return;
    }
    for (long long i = 0, k = 1; i < n; i++) {
      if (lft / k == 0)
        retcost(lft - k, cc + c[i]);
      else
        retcost(lft - (lft / k) * k, cc + (lft / k) * c[i]);
      k *= 2;
    }
  }
}
void Onigiri() {
  cin >> n >> l;
  for (long long i = 0; i < n; i++) cin >> c[i];
  cost = l * c[0];
  retcost(l, 0);
  cout << cost;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    Onigiri();
    cout << "\n";
  }
  return 0;
}
