#include <bits/stdc++.h>
using namespace std;
int orig[200100];
long long bin[200100];
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  for (long long i = 0; i < n + 1; i++) {
    scanf("%d", &orig[i]);
    bin[i] = orig[i];
  }
  for (long long i = 0; i < n + 1; i++) {
    if (bin[i] & 1) {
      if (bin[i] < 0)
        bin[i + 1] -= (abs(bin[i]) + 1) / 2;
      else
        bin[i + 1] += bin[i] / 2;
      bin[i] = 1;
    } else {
      bin[i + 1] += bin[i] / 2;
      bin[i] = 0;
    }
  }
  int zero = 0;
  while (bin[zero] == 0) zero++;
  int ans = 0;
  for (int i = n + 1; i >= 0; i--) {
    bin[i] += bin[i + 1] * 2;
    bin[i + 1] = 0;
    if (abs(bin[i]) > 2 * k) break;
    if (i <= zero) {
      long long newCoef = (long long)orig[i] - bin[i];
      if (abs(newCoef) <= k && (i < n || (i == n && newCoef))) {
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
