#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  bool operator<(const point &a) const { return x > a.x; }
};
priority_queue<int> que;
long long a[210000];
int main() {
  long long n, k;
  while (~scanf("%lld%lld", &n, &k)) {
    for (int i = 0; i <= n; i++) {
      scanf("%lld", &a[i]);
    }
    long long p = 0, first1 = a[0];
    while (first1 % 2 == 0) {
      p++;
      first1 = first1 / 2 + a[p];
    }
    while (n < p) {
      p--;
      first1 = first1 + first1;
    }
    long long sum = 0, oversum = k * 10, ff = 0;
    for (int i = n; i >= p; i--) {
      sum = sum + sum + a[i];
      if (sum > oversum || sum < -oversum) {
        ff = 1;
        break;
      }
    }
    if (ff) {
      printf("0\n");
      continue;
    }
    int ans = 0, i9 = p;
    sum = sum + first1 - a[i9];
    if (i9 == n && sum == a[i9]) {
      i9--;
      sum = sum + sum;
    }
    while (sum < oversum && sum > -oversum && i9 >= 0) {
      if ((a[i9] - sum >= -k) && (a[i9] - sum <= k)) ans++;
      i9--;
      sum = sum + sum;
    }
    printf("%d\n", ans);
  }
  return 0;
}
