#include <bits/stdc++.h>
using namespace std;
void Genawy() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
int n;
long long l;
vector<long long> cost;
vector<bool> used;
long long solve(long long cur) {
  double mn = 1e14;
  int u = -1;
  for (int i = 0; i < n; i++) {
    if (used[i]) continue;
    if (cost[i] * 1.0 / (1LL << i) < mn) {
      mn = cost[i] * 1.0 / (1LL << i);
      u = i;
    }
  }
  if (u == -1) return 1e14;
  used[u] = true;
  long long ret = cur / (1LL << u) * cost[u];
  long long rem = cur % (1LL << u);
  if (rem == 0) return ret;
  long long ret1 = cost[u];
  ret1 = min(ret1, solve(rem));
  return ret + ret1;
}
int main() {
  Genawy();
  cin >> n;
  cin >> l;
  cost.resize(n);
  used.resize(n);
  for (int i = 0; i < n; i++) cin >> cost[i];
  cout << solve(l) << endl;
  return 0;
}
