#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-18;
const double DEPS = 1e-9;
const long double PI = 3.141592653589793238;
const long long MOD = (int)1e9 + 7;
const int N = int(5e5) + 10;
void inp() {}
void out() {}
long long n, d, a[32], bitm[32], ans = 1e18, sm;
int main() {
  inp();
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    scanf("%lld", a + i);
  }
  for (int i = 0; i < 32; i++) {
    bitm[i] = 1e18;
  }
  for (int i = 0; i < 32; i++) {
    long long mul = 2;
    for (int j = i - 1; j >= 0; j--) {
      bitm[i] = min(bitm[i], mul * a[j]);
      mul *= 2;
    }
    for (int j = i; j < n; j++) {
      bitm[i] = min(bitm[i], a[j]);
    }
    if (!bitm[i]) {
      bitm[i] = bitm[i - 1] * 2;
    }
  }
  for (int i = 30; i >= 0; i--) {
    if (d >> i & 1) {
      sm += bitm[i];
    } else {
      ans = min(ans, sm + bitm[i]);
    }
  }
  ans = min(ans, sm);
  cout << ans << endl;
}
