#include <bits/stdc++.h>
using namespace std;
long long c[64];
long long dp(int i, int l) {
  if (!l) return 0;
  if (i == 0) return c[0];
  return min(c[i] + (((l >> i) & 1) ? c[i] : 0),
             dp(i - 1, l & ~(1 << i)) + (((l >> i) & 1) ? c[i] : 0));
}
int main() {
  int n, L;
  scanf("%d%d", &n, &L);
  for (int i = 0; i < (30); ++i) {
    if (i < n)
      scanf("%lld", &c[i]);
    else
      c[i] = 9223372036854775807;
    if (i) {
      c[i] = min(c[i - 1] * 2, c[i]);
    }
  }
  long long a = 0;
  int better[64], best[64];
  for (int i = 0; i < (30); ++i) {
    better[i] = i;
    best[i] = i;
  }
  for (int i = 29; i > 0; --i) {
    if (c[better[i]] / (int)pow(2, better[i] - i + 1) < c[i - 1]) {
      better[i - 1] = better[i];
    }
    if (c[best[i]] < c[i - 1]) {
      best[i - 1] = best[i];
    }
  }
  printf("%lld\n", dp(29, L));
  return 0;
}
