#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, l;
  cin >> n >> l;
  long long int a[40] = {0};
  long long int mn = 1e10;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mn = min(mn, a[i]);
  }
  bool fl = false;
  for (long long int i = n - 1; i >= 0; i--) {
    if (a[i] == mn) fl = true;
    if (fl) a[i] = mn;
  }
  for (long long int i = 1; i < n; i++) {
    a[i] = min(a[i], a[i - 1] * 2);
  }
  for (long long int i = n; i < 33; i++) {
    a[i] = a[i - 1] * 2;
  }
  long long int ans = 0, tl = l;
  for (long long int i = 0; i < 33; i++) {
    if (l % 2) {
      ans += a[i];
    }
    l /= 2;
  }
  l = tl;
  long long int sm = 0;
  for (long long int i = 0; i < 32; i++) {
    if (l % 2) sm += a[i];
    l /= 2;
    if (a[i + 1] + ans - sm < ans) {
      ans = a[i + 1] + ans - sm;
      sm = a[i + 1];
    }
  }
  cout << ans << endl;
  return 0;
}
