#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int N = 2e5;
int n;
long long k, a[N + 5];
long long pref[N + 5];
int main() {
  scanf("%d", &n);
  scanf("%lld", &k);
  for (int i = 0; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = n; i >= 0; i--) {
    pref[i] = pref[i + 1] * 2ll + a[i];
    pref[i] = max(-INF, min(pref[i], INF));
  }
  int ans = 0;
  long long bef = 0ll;
  for (int i = 0; i <= n && (bef % 2 == 0); i++) {
    bef /= 2ll;
    bef = max(-INF, min(bef, INF));
    long long tmp = abs(pref[i + 1] * 2ll + bef);
    if (tmp <= k && (i < n || tmp != 0)) ans++;
    bef += a[i];
  }
  printf("%d\n", ans);
  return 0;
}
