#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 10e18;
long long int n, k, arr[35], sol = maxn, zbroj[35];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < 32; i++) arr[i] = maxn;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i < 32; i++) {
    arr[i] = min(arr[i], 2 * arr[i - 1]);
  }
  for (int i = 31; i >= 0; i--) {
    if (k & (1 << i)) {
      zbroj[i] = zbroj[i + 1] + arr[i];
    } else {
      zbroj[i] = zbroj[i + 1];
    }
  }
  sol = min(sol, zbroj[0]);
  for (int i = 31; i >= 0; i--) {
    if (!(k & (1 << i))) {
      sol = min(sol, arr[i] + zbroj[i]);
    }
  }
  cout << sol;
  return 0;
}
