#include <bits/stdc++.h>
using namespace std;
int n, l;
long long a[31], res;
int main() {
  cin >> n >> l;
  for (int i = 0; i <= 30; i++) {
    if (i < n)
      cin >> a[i];
    else
      a[i] = 1e18;
    if (i) a[i] = min(a[i], a[i - 1] << 1);
    if (l >> i & 1)
      res += a[i];
    else
      res = min(res, a[i]);
  }
  cout << res;
}
