#include <bits/stdc++.h>
using namespace std;
long long bbuy(long long* c, long long l, int n);
int main() {
  long long n, l;
  cin >> n >> l;
  long long c[n];
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  long long bp = c[0];
  for (int i = 0; i < n; ++i) {
    bp *= 2;
    bp = min(bp, c[i]);
    if (bp != c[i]) c[i] = -1;
  }
  long long bcost = 0;
  bcost += bbuy(c, l, n);
  cout << bcost;
  return 0;
}
long long bbuy(long long* c, long long l, int n) {
  int i = int(log2(l));
  long long gcost = 0;
  long long cost = 0, buy;
  long long prev = l;
  while (i >= n || c[i] == -1) i--;
  buy = l / pow(2, i);
  l -= buy * pow(2, i);
  cost = buy * c[i];
  if (l > 0) cost += bbuy(c, l, n);
  for (int j = i + 1; j < n; ++j) {
    l = prev;
    if (c[j] == -1) continue;
    buy = (l / pow(2, j)) + 1;
    if (cost > buy * c[j]) {
      cost = buy * c[j];
      l -= buy * pow(2, j);
    }
  }
  gcost += cost;
  return gcost;
}
