#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long exp, long long m) {
  long long acc = 1;
  while (exp > 0) {
    if (exp & 1) {
      acc = acc * x;
      if (acc >= m) acc %= m;
      --exp;
    } else {
      x *= x;
      if (x >= m) x %= m;
      exp /= 2;
    }
  }
  return acc;
}
int count = 10;
long long modula[] = {2000000143, 2000000279, 2000000269, 2000000333,
                      2000000227, 2100000449, 2100000407, 2100000173,
                      2100000053, 2100000151};
long long binpower[200010][10];
long long Q2[10];
long long a[200010];
bool good(long long x, int k, int num, int max) {
  if (num == max && x == 0) return false;
  return x >= -k && x <= k;
}
int main() {
  int n, k;
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
  }
  long long bins[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  for (int j = 0; j < 10; j++) binpower[0][j] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 10; j++) {
      bins[j] *= 2;
      if (bins[j] >= modula[j]) bins[j] -= modula[j];
      binpower[i][j] = bins[j];
    }
  }
  for (int i = 0; i < 10; i++) Q2[i] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < 10; j++) {
      Q2[j] += a[i] * binpower[i][j];
      if (Q2[j] < 0) Q2[j] += (-Q2[j]) / modula[j] * modula[j];
      while (Q2[j] < 0) Q2[j] += modula[j];
      if (Q2[j] > modula[j]) Q2[j] %= modula[j];
    }
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    bool flag = true;
    long long cc[10];
    for (int j = 0; j < 10; j++) {
      long long c = -Q2[j] * power(binpower[i][j], modula[j] - 2, modula[j]);
      if (c < 0) c += (-c) / modula[j] * modula[j];
      while (c < 0) c += modula[j];
      c %= modula[j];
      if (good(a[i] + c, k, i, n)) {
        cc[j] = c;
      } else if (good(a[i] + c + modula[j], k, i, n)) {
        cc[j] = c + modula[j];
      } else if (good(a[i] + c - modula[j], k, i, n)) {
        cc[j] = c - modula[j];
      } else {
        flag = false;
      }
      if (!flag) break;
    }
    for (int j = 0; j < 9; j++) {
      if (cc[j] != cc[j + 1]) flag = false;
    }
    if (flag) ans++;
  }
  cout << ans << endl;
  return 0;
}
