#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long inf = (long long)1e18 + 100;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, l;
  cin >> n >> l;
  vector<long long> c(n + 5);
  set<long long> s;
  for (long long i = 0; i < n; ++i) cin >> c[i];
  for (long long i = n - 1; i > -1; --i) {
    for (long long j = 0; j < i; ++j) {
      c[i] = min((1LL << (i - j)) * c[j], c[i]);
    }
  }
  long long ans = 0;
  set<long long> possible;
  for (long long i = n - 1; i > -1; --i) {
    if (l <= 0) break;
    long long req = l / (1LL << i);
    if (l % (1LL << i) != 0) {
      possible.insert(ans + (req + 1) * c[i]);
    }
    ans += req * c[i];
    l -= req * (1LL << i);
  }
  if (!possible.empty()) ans = min(ans, *possible.begin());
  cout << ans << "\n";
  return 0;
}
