#include <bits/stdc++.h>
using namespace std;
long long int cost[33];
long long int dp[35];
bool flag[35];
long long int n, L;
int main() {
  cin >> n >> L;
  for (int i = 0; i < n; i++) cin >> cost[i];
  for (int i = 0; i < 33; i++) {
    if (i < n) {
      dp[i] = cost[i];
      if (i > 0) dp[i] = min(dp[i], 2LL * dp[i - 1]);
    } else {
      dp[i] = 2LL * dp[i - 1];
    }
  }
  long long int minn = dp[32];
  for (int i = 32; i >= 0; i--) {
    if (minn < dp[i]) {
      dp[i] = minn;
      flag[i] = 1;
    }
    minn = min(minn, dp[i]);
  }
  long long int res2 = 1000000000000000000;
  long long int res = 0;
  long long int temp = 0;
  while (L > 0) {
    long long int x = log2(L);
    temp = res + dp[x + 1];
    res2 = min(res2, temp);
    res += dp[x];
    L -= (1LL << x);
  }
  res = min(res, res2);
  cout << res << endl;
  return 0;
}
