#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
const long long INF = 9e18;
const int LOG = 30;
long long c[MAXN];
long long dp[MAXN];
void solve() {
  int n, L;
  cin >> n >> L;
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i <= LOG; i++) dp[i] = INF;
  for (int i = 0; i <= LOG; i++) {
    if (i < n) {
      dp[i] = c[i];
    }
    long long cur = 1;
    for (int j = i - 1; j >= 0; j--) {
      cur <<= 1;
      if (cur > dp[i]) break;
      dp[i] = min(dp[i], dp[j] * cur);
    }
  }
  long long ans = 0;
  for (int i = 0; i <= LOG; i++) {
    if (L & (1 << i)) {
      ans += dp[i];
    }
    if (0) cout << "DP[ " << i << "] = " << dp[i] << endl;
  }
  for (int rep = 0; rep <= LOG; rep++) {
    if (L & (1 << rep)) {
      continue;
    }
    long long l2 = L | (1 << rep);
    for (int j = 0; j < rep; j++) {
      if (l2 & (1 << j)) {
        l2 ^= 1 << j;
      }
    }
    long long cur = 0;
    for (int j = 0; j <= LOG; j++) {
      if (l2 & (1 << j)) {
        cur += dp[j];
      }
    }
    ans = min(ans, cur);
  }
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
