#include <bits/stdc++.h>
using namespace std;
void Kinishinaide() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
const long long N = 1e2 + 7;
const long long Mod = 1e9 + 7;
const long long Inf = 1e18 + 7;
int M, L;
long long Aq[N];
long long dp[N], Ans;
int main() {
  Kinishinaide();
  cin >> M >> L;
  memset(dp, Inf, sizeof(dp));
  for (int i = 0; i < M; i++) {
    cin >> Aq[i];
    if (i) {
      dp[i] = min(Aq[i], (dp[i - 1] << 1));
    } else {
      dp[i] = Aq[i];
    }
  }
  long long Sum = false, Ans = Inf;
  for (int i = M - 1; i >= 0; i--) {
    Sum += 1LL * (L / (1 << i)) * dp[i];
    L = L % (1 << i);
    Ans = min(Ans, Sum + 1LL * (L > 0) * dp[i]);
  }
  cout << Ans;
}
