#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, l;
  long long c[35];
  scanf("%lld %lld", &n, &l);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &c[i]);
  }
  long long tot = 0, ans = -1;
  while (l) {
    long long t = 1;
    while ((t << 1) <= l) {
      t <<= 1;
    }
    long long mn = -1;
    long long i;
    for (i = 1; i <= n; i++) {
      if (t < (1 << (i - 1))) {
        break;
      }
      long long p = t / (1 << (i - 1));
      if (mn == -1) {
        mn = p * c[i];
      } else {
        mn = min(mn, p * c[i]);
      }
    }
    bool flag = false;
    for (; i <= n; i++) {
      if (ans == -1) {
        ans = c[i] + tot;
      } else {
        ans = min(ans, c[i] + tot);
      }
    }
    l -= t;
    tot += mn;
  }
  if (ans == -1) {
    ans = tot;
  } else {
    ans = min(ans, tot);
  }
  printf("%lld\n", ans);
}
