#include <bits/stdc++.h>
using namespace std;
int n, m, s[35];
long long ans, res = 0xfffffffffffffff;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    if (i) s[i] = min(s[i - 1] * 2, s[i]);
  }
  for (int i = n - 2; i >= 0; i--) s[i] = min(s[i], s[i + 1]);
  for (int i = n - 1; i >= 0; i--) {
    res = min(res, ans + (long long)s[i] * (m / (1ll << i) + 1));
    ans += (long long)s[i] * (m / (1ll << i));
    m %= (1ll << i);
  }
  printf("%I64d\n", min(ans, res));
  return 0;
}
