#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long long C = -1e13;
  C--;
  vector<int> A(n + 1);
  for (int i = 0; i <= n; i++) cin >> A[i];
  vector<long long> L(n, C), R(n, C);
  if (A[0] % 2 == 0) L[0] = -A[0] / 2;
  R[n - 1] = A[n];
  for (int i = 1; i < n; i++) {
    R[n - 1 - i] = A[n - i] + 2 * R[n - i];
    if (R[n - 1 - i] > 1e13 || R[n - 1 - i] < -1e13) R[n - 1 - i] = C;
    if (L[i - 1] == C)
      L[i] = C;
    else {
      L[i] = -A[i] + L[i - 1];
      if (L[i] % 2 == 0)
        L[i] = L[i] / 2;
      else
        L[i] = C;
    }
  }
  int ans = 0;
  long long newc = -2 * R[0];
  if (llabs(newc) <= k) ans++;
  for (int i = 1; i < n; i++) {
    long long newc = -2 * R[i] + L[i - 1];
    if (llabs(newc) <= k) ans++;
  }
  newc = L[n - 1];
  if (llabs(newc) <= k && newc != 0) ans++;
  printf("%d", ans);
  return 0;
}
