#include <bits/stdc++.h>
using namespace std;
long long bottle_types;
long long litres;
long long temp;
long long price[35];
long long a;
long long y;
long long answer = 1e18;
int main() {
  cin >> bottle_types >> litres;
  for (a = 0; a < bottle_types; a++) {
    cin >> price[a];
    if (a) {
      price[a] = min(price[a - 1] * 2, price[a]);
    }
  }
  for (a = bottle_types - 1; a >= 0; a--) {
    temp = (1 << a);
    y += price[a] * (litres / temp);
    litres %= temp;
    answer = min(answer, y + (litres != 0) * price[a]);
  }
  cout << answer;
  return 0;
}
