#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
inline void readll(long long &x) {
  long long f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int maxn = 100000 + 10;
long long cost[maxn], volume[maxn];
long long n, L;
int main() {
  cin >> n >> L;
  for (long long i = 0; i < n; i++) {
    cin >> cost[i];
  }
  for (long long i = 1; i < n; i++) cost[i] = min(cost[i], cost[i - 1] * 2);
  long long Base = 1, cnt = 0, ans = (long long)(5e18);
  long long Ans = 0;
  for (long long i = n - 1; i >= 0; i--) {
    long long number = L / (1ll << i);
    Ans += number * cost[i];
    L -= number * (1ll << i);
    ans = min(ans, Ans + (L > 0) * cost[i]);
  }
  cout << ans << endl;
  return 0;
}
