#include <bits/stdc++.h>
using namespace std;
bool rev(long long x, long long y) { return x > y; }
void input_arr(long long a[], long long n) {
  for (long long i = 0; i < n; i += 1) cin >> a[i];
}
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return a.second < b.second;
}
bool sortinrev(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.first > b.first);
}
void print_vec(vector<long long> &v) {
  for (auto i : v) cout << i << " ";
  cout << '\n';
}
bool sortinrevbysec(const pair<long long, long long> &a,
                    const pair<long long, long long> &b) {
  return (a.second > b.second);
}
void print_arr(long long a[], long long n) {
  for (long long i = 0; i < n; i += 1) cout << a[i] << " ";
  cout << '\n';
}
template <typename... T>
void input(T &...args) {
  ((cin >> args), ...);
}
template <typename... T>
void print(T &&...args) {
  ((cout << args << '\n'), ...);
}
template <typename... T>
void deb(T &&...args) {
  cout << "~~ ";
  ((cout << args << " "), ...);
  cout << '\n';
}
void stand8th() {
  long long n, l;
  input(n, l);
  long long a[n];
  input_arr(a, n);
  for (long long i = 1; i < n; i += 1) {
    a[i] = min(a[i], a[i - 1] * 2);
  }
  long long ans = INT64_MAX;
  long long summ = 0;
  for (long long i = n - 1; i >= 0; i--) {
    if (pow(2, i) >= l) {
      ans = min(ans, summ + a[i]);
    } else {
      long long cnt = l / (long long)(pow(2, i));
      summ += cnt * a[i];
      l -= cnt * (long long)(pow(2, i));
      if (l == 0) {
        ans = min(ans, summ);
      } else {
        ans = min(ans, summ + a[i]);
      }
    }
  }
  print(ans);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tin = 1;
  while (tin--) {
    stand8th();
  }
  return 0;
}
