#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
int sgn(T x) {
  return x > 0 ? 1 : (x < 0 ? -1 : 0);
}
const long double pi = acos(-1.0);
const long long MAX = 1e18;
int n;
int m;
int a[200001];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= n; i++) scanf("%d", &a[i]);
  long long cur = 0;
  int pw = 0;
  for (int i = 0; i < n; i++) {
    if ((cur + a[i]) % 2 != 0) break;
    cur = (cur + a[i]) / 2;
    pw++;
  }
  long long delta = 0;
  for (int i = n; i >= pw; i--) {
    delta = delta * 2 + a[i];
    if (abs(delta) > MAX) {
      printf("0\n");
      return 0;
    }
  }
  cur += delta;
  int ans = 0;
  while (pw >= 0 && abs(cur) < MAX) {
    long long na = a[pw] - cur;
    if (abs(na) <= m && (na != 0 || pw != n)) ans++;
    cur *= 2;
    pw--;
  }
  printf("%d\n", ans);
  return 0;
}
