#include <bits/stdc++.h>
using namespace std;
long n, vt;
long long k, t;
long p[200005];
long long h[200005];
int main() {
  cin >> n >> k;
  for (long i = 0; i < n + 1; i++) {
    scanf("%ld", &p[i]);
  }
  t = 0, vt = n + 1;
  for (long i = n + 1 - 1; i >= 0; i--) {
    t += p[i];
    t *= 2;
    if (llabs(t) >= 2 * k) break;
    vt = i;
    h[i] = t;
  }
  cout << endl;
  t = 0;
  long ans = 0;
  for (long i = 0; i < n + 1; i++) {
    if (i + 1 >= vt) {
      long long tmp = -h[i + 1] - t;
      if (llabs(tmp) <= k && !(i == n && !tmp)) ans++;
    }
    t += p[i];
    if (llabs(t) % 2) break;
    t >>= 1;
  }
  cout << ans;
  return 0;
}
