#include <bits/stdc++.h>
using namespace std;
const int maxN = 35;
const int inf = 2147483647;
long long n, L;
long long Cost[maxN], Sum[maxN];
int main() {
  for (int i = 0; i < maxN; i++) Cost[i] = 6e18;
  cin >> n >> L;
  long long pos;
  for (pos = 0; (1ll << pos) <= L; pos++)
    ;
  for (int i = 0; i < n; i++) cin >> Cost[i];
  for (int i = n - 2; i >= 0; i--) Cost[i] = min(Cost[i], Cost[i + 1]);
  for (int i = 1; i <= pos + 1; i++) Cost[i] = min(Cost[i], Cost[i - 1] * 2);
  Sum[0] = Cost[0];
  for (int i = 1; i <= pos + 1; i++) Sum[i] = Sum[i - 1] + Cost[i];
  long long Ans = Cost[pos];
  long long ret = 0;
  for (int i = pos; i >= 0; i--) {
    Ans = min(Ans, ret + Cost[i + 1]);
    ret = ret + ((L & (1 << i)) != 0) * Cost[i];
  }
  Ans = min(Ans, ret);
  printf("%lld\n", Ans);
  return 0;
}
