#include <bits/stdc++.h>
using namespace std;
int n;
long long l, c[34];
long long ans1 = 0, ans2 = 5e18;
int main() {
  cin >> n >> l;
  for (int i = 0; i < 34; i++) c[i] = 1e18;
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 1; i < 34; i++)
    c[i] = min((long long)2e18, min(c[i], c[i - 1] * 2));
  for (long long i = 0; i < 34; i++) {
    long long tmp = 0;
    for (long long j = 0; j < 34; j++) {
      if (l & (1LL << j)) tmp += c[j];
    }
    ans2 = min(ans2, tmp);
    if (l & (1LL << i)) l += (1LL << i);
  }
  cout << ans2 << "\n";
}
