#include <bits/stdc++.h>
using namespace std;
int cas = 1, T;
int n, k, a[100000 * 2 + 100], p[100000 * 2 + 100];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) {
    scanf("%d", a + i);
    p[i] = a[i];
  }
  int lb = -1, hb;
  for (int i = 0; i < n; i++) {
    if (p[i] < 0) {
      p[i] = -p[i];
      p[i + 1] -= p[i];
    }
    p[i + 1] += p[i] >> 1;
    p[i] &= 1;
  }
  int neg = 1;
  if (p[n] < 0) neg = -1;
  if (p[n] < 0)
    for (int i = 0; i <= n; i++) p[i] = -p[i];
  for (int i = 0; i < n; i++) {
    if (p[i] < 0) {
      p[i] = -p[i];
      p[i + 1] -= p[i];
    }
    p[i + 1] += p[i] >> 1;
    p[i] &= 1;
  }
  for (int i = 0; i <= n; i++) {
    if (p[i]) {
      hb = i;
      if (lb == -1) lb = i;
    }
  }
  int ans = 0;
  if (hb - lb <= 32) {
    long long x = 0;
    for (int i = 0, j = lb; j <= hb; j++, i++) x += p[j] * (1LL << i);
    for (int i = max(0, lb - 32); i <= min(n, lb); i++) {
      long long t = x * (1LL << (lb - i)) * neg;
      long long y = a[i] - t;
      if (abs(y) <= k) ans++;
      if (i == n && !y) ans--;
    }
  }
  printf("%d\n", ans);
  return 0;
}
