#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long n, l, c[223456], ans = inf, total;
int main(void) {
  cin >> n >> l;
  for (long long i = 0; i < n; i++) cin >> c[i];
  for (long long i = 1; i < n; i++) {
    c[i] = min(c[i], 2 * c[i - 1]);
  }
  for (long long i = n - 1; i >= 0; i--) {
    long long d = l / (1 << i);
    total += d * c[i];
    l -= d << i;
    ans = min(ans, total + (l > 0) * c[i]);
  }
  cout << ans << endl;
  return 0;
}
