#include <bits/stdc++.h>
using namespace std;
long long c[31], n, L, ans = 4000000000000000000, sum;
int main() {
  cin >> n >> L;
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < n - 1; i++) c[i + 1] = min(c[i + 1], 2 * c[i]);
  for (int i = n - 1; i >= 0; i--) {
    int needed = L / (1 << i);
    sum += needed * c[i];
    L -= needed << i;
    ans = min(ans, sum + c[i] * (L > 0));
  }
  cout << ans;
}
