#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const int nmax = 35;
int n;
int L;
long long c[nmax];
int getbit(int x, int i) { return (x >> i) & 1; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  cin >> n >> L;
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 1; i < n; i++) c[i] = min(c[i], 2 * c[i - 1]);
  long long ans = LINF;
  long long sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    long long need = L / (1 << i);
    sum += need * c[i];
    L %= 1 << i;
    ans = min(ans, sum + (L > 0) * c[i]);
  }
  cout << ans;
  return 0;
}
