#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
template <typename T>
void gi(T &ret) {
  ret = 0;
  char inp = getchar();
  int kl = 1;
  while (inp < '0' || inp > '9') {
    if (inp == '-') kl = -1;
    inp = getchar();
  }
  while ('0' <= inp && inp <= '9')
    ret = (ret << 3) + (ret << 1) + (inp - '0'), inp = getchar();
  if (kl < 1) ret = -ret;
}
const int bts = 30;
const long long inf = 1LL << 61LL;
int n, s;
long long val[bts + 5], sum = 0LL, ans = inf;
int main() {
  gi(n);
  gi(s);
  for (int i = 0; i < bts; i++) val[i] = inf;
  for (int i = 0; i < n; i++) gi(val[i]);
  for (int i = bts - 2; i >= 0; i--) val[i] = min(val[i], val[i + 1]);
  for (int i = 1; i < bts; i++) val[i] = min(val[i], val[i - 1] * 2LL);
  for (int i = bts - 1; i >= 0; i--) {
    if ((s >> i) & 1) sum += val[i];
    ans = min(ans, sum + val[i]);
  }
  ans = min(ans, sum);
  printf("%lld\n", ans);
  return 0;
}
