#include <bits/stdc++.h>
using namespace std;
long long a[33];
long long b[33];
long long c[33];
int main() {
  int n, l;
  c[0] = 1;
  memset(a, 0x3f, sizeof(a));
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= 31; i++) {
    c[i] = c[i - 1] * 2;
    a[i] = min(a[i], a[i - 1] + a[i - 1]);
    b[i] = b[i - 1] + a[i - 1];
  }
  int o = 0;
  long long ans = 0;
  while (l) {
    if (l & 1)
      ans += a[o];
    else if (ans > a[o])
      ans = a[o];
    o++;
    l >>= 1;
  }
  for (int i = o; i <= 31; i++)
    if (ans > a[i]) ans = a[i];
  printf("%lld\n", ans);
  return 0;
}
