#include <bits/stdc++.h>
using namespace std;
int i, n, m, b[10000];
long long x, y, a[100000];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= 31; i++) a[i] = 7000000000000000000;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= 31; i++) {
    long long now = a[i];
    for (int j = i + 1; j <= 31; j++) {
      now *= 2;
      if (now < a[j]) {
        a[j] = now;
      }
    }
  }
  long long ans = 0, ans1 = 0;
  int len = 0;
  while (m) {
    len++;
    b[len] = m % 2;
    m /= 2;
  }
  ans = 7000000000000000000;
  for (int i = 31; i >= 1; i--) {
    if (b[i] == 1) {
      ans1 += a[i];
    } else {
      ans = min(ans, ans1 + a[i]);
    }
  }
  ans = min(ans, ans1);
  cout << ans;
  return 0;
}
