#include <bits/stdc++.h>
using namespace std;
int n, l, c[35];
long long sm, ini;
bool ch;
int main() {
  scanf("%d %d", &n, &l);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
    if (i != 0) c[i] = min(c[i], 2 * c[i - 1]);
  }
  ini = 2LL * (l >> n) * (long long)c[n - 1];
  l %= (1 << n);
  for (int i = 0; i < n; ++i) {
    if (sm > c[i]) sm = c[i];
    if (((1 << i) & l) != 0) sm += c[i];
  }
  for (int i = 0; i < n; ++i) {
    if ((l >> i) == 0) {
      sm = min(sm, (long long)c[i]);
    }
  }
  printf("%lld\n", sm + ini);
  return 0;
}
