#include <bits/stdc++.h>
using namespace std;
long long a[32];
long long n, m, ans;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    a[i] = min(a[i], a[i - 1] * 2);
    a[i - 1] = min(a[i], a[i - 1]);
  }
  for (int i = n; i < 31; i++) a[i] = 2 * a[i - 1];
  for (int i = 0; i < 30; i++) {
    if (m & (1 << i)) ans += a[i];
    ans = min(ans, a[i + 1]);
  }
  cout << ans << endl;
  return 0;
}
