#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = LLONG_MAX;
long long a[35], l, n, p = 0;
signed main() {
  long long n, l;
  cin >> n >> l;
  long long a[n + 1];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (i > 0) a[i] = min(a[i], 2 * a[i - 1]);
  }
  long long sum = 0, ans = inf;
  for (long long i = n - 1; i >= 0; i--) {
    long long nd = l / (1 << i);
    sum += nd * a[i];
    l -= nd * (1 << i);
    ans = min(ans, sum + (l > 0) * a[i]);
  }
  cout << ans << '\n';
  return 0;
}
