#include <bits/stdc++.h>
int main(int argc, char *argv[]) {
  long long L;
  int n;
  long long c[35];
  scanf("%d %I64d", &n, &L);
  for (int i = 1; i <= 33; ++i) {
    c[i] = 1e18;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &c[i]);
  }
  for (int i = 1; i <= 32; ++i) {
    if (c[i] * 2 < c[i + 1]) {
      c[i + 1] = c[i] * 2;
    }
  }
  long long res = 0;
  for (int i = 1; i <= 33; ++i) {
    long long t = (long long)1 << ((long long)i - 1);
    if (c[i] < res) {
      res = c[i];
    }
    if (L & t) {
      res += c[i];
    }
  }
  printf("%I64d\n", res);
  return 0;
}
