#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
const long long INF = 1e9;
const long long mod = 1e9 + 7;
const long long LINF = 1e14;
using namespace std;
long long n, l;
vector<long long> c;
vector<int> b;
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> l;
  c.resize(n);
  cin >> c[0];
  for (long long i = (1); i < (n); i++) {
    cin >> c[i];
    c[i] = min(c[i - 1] * 2, c[i]);
  }
  while (l > 0) b.push_back(l % 2), l /= 2;
  while (c.size() < b.size()) c.push_back(c.back() * 2);
  while (b.size() < c.size()) b.push_back(0);
  c.push_back(c.back() * 2);
  n = b.size();
  vector<long long> d(n + 1, LINF);
  d[0] = 0;
  for (long long i = (1); i < (n + 1); i++) {
    d[i] = min(d[i - 1], c[i - 1]);
    if (b[i - 1] == 1) d[i] += c[i - 1];
  }
  cout << min(d[n], c.back()) << endl;
  return 0;
}
