#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n = 0, l = 0, ans = 0;
  scanf("%lld %lld", &n, &l);
  int total = 31;
  long long c[total];
  for (int i = 0; i < n; i++) {
    scanf("%lld", &c[i]);
  }
  for (int i = n; i < total; i++) {
    c[i] = 1e18;
  }
  for (int i = 1; i < total; i++) {
    c[i] = min(2 * c[i - 1], c[i]);
  }
  for (int i = 0; i <= total - 1; i++) {
    long long op = l & (1 << i);
    if (op > 0) {
      ans += c[i];
    }
    if (i == total - 1) break;
    ans = min(ans, c[i + 1]);
  }
  printf("%lld", ans);
  return 0;
}
