#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int maxN = 200005;
int n, a[maxN], k;
long long sumP[maxN], sumS[maxN];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = n; i >= 0; --i) {
    sumS[i] = a[i] + 2 * sumS[i + 1];
    if (sumS[i] > inf) sumS[i] = inf;
    if (sumS[i] < -inf) sumS[i] = -inf;
  }
  for (int i = 0; i <= n; ++i) {
    if (i == 0) {
      sumP[i] = a[i];
      continue;
    }
    if (sumP[i - 1] == inf || sumP[i - 1] == -inf) {
      sumP[i] = sumP[i - 1];
      continue;
    }
    if (sumP[i - 1] % 2 == 0) {
      sumP[i] = a[i] + sumP[i - 1] / 2;
    } else {
      sumP[i] = inf;
    }
  }
  int res = 0;
  for (int i = 0; i <= n; ++i) {
    long long lf = (i == 0 ? 0 : sumP[i - 1]);
    long long rf = sumS[i + 1];
    if (lf == inf || lf == -inf || rf == inf || rf == -inf) continue;
    long long cur = lf + 4 * rf;
    if (cur % 2 != 0) continue;
    cur /= 2;
    if (cur == 0 && i == n) continue;
    if (cur <= k && cur >= -k) ++res;
  }
  printf("%d\n", res);
  return 0;
}
