#include <bits/stdc++.h>
using namespace std;
long long p[35];
int main() {
  int n, l;
  long long ret = -1;
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; i++) scanf("%lld", &p[i]);
  for (int i = 1; i < 31; i++)
    if (p[i] == 0 or p[i] > p[i - 1] * 2) p[i] = p[i - 1] * 2;
  for (int i = 30; (1 << i) >= l; i--)
    if (ret < 0 or ret > p[i]) ret = p[i];
  string bin = "";
  while (l) {
    bin += (l % 2 + '0');
    l /= 2;
  }
  long long t = 0;
  for (int i = bin.length() - 1; i >= 0; i--) {
    if (ret == -1 or ret > p[i] * (bin[i] - '0' + 1) + t)
      ret = p[i] * (bin[i] - '0' + 1) + t;
    t += (bin[i] - '0') * p[i];
  }
  ret = min(ret, t);
  printf("%lld\n", ret);
}
