#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b, long long int n) {
  long long int ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % n;
    a = (a * a) % n;
    b /= 2;
  }
  return ans;
}
pair<long long int, long long int> c[32];
map<pair<long long int, long long int>, long long int> m;
long long int get(long long int l, long long int n) {
  if (l <= 0) return 0;
  double m = 10000000000000000;
  int p;
  for (int i = 0; i <= n; i++) {
    double x = ((double)c[i].first) / c[i].second;
    if (x < m) {
      m = x;
      p = i;
    }
  }
  if (p == 0) return l * c[0].first;
  long long int a = (l / c[p].second) * c[p].first;
  return min(a + c[p].first,
             a + get(l - (l / c[p].second) * c[p].second, n - 1));
}
signed main() {
  long long int n, l;
  scanf("%lld", &(n));
  scanf("%lld", &(l));
  for (int i = 0; i < n; i++) {
    scanf("%lld", &(c[i].first));
    c[i].second = pow(2, i);
  }
  cout << get(l, n - 1);
  return 0;
}
