#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
const int mod = 1e9 + 7;
const int maxn = 200000 + 10;
const int maxlog = 35;
int n;
long long k;
long long a[maxn];
long long bit[maxn + maxlog];
int main() {
  scanf("%d%I64d", &n, &k);
  for (int i = 0; i <= n; i++) {
    scanf("%I64d", &a[i]);
    bit[i] = a[i];
  }
  int tn = n + maxlog;
  int sig = 1;
  for (int i = 0; i < tn - 1; i++) {
    bit[i + 1] += bit[i] / 2;
    bit[i] %= 2;
    if (bit[i]) sig = bit[i];
  }
  if (sig == -1)
    for (int i = 0; i < tn; i++) bit[i] = -bit[i];
  int l = -1, r;
  for (int i = 0; i < tn; i++) {
    bit[i + 1] += bit[i] / 2;
    bit[i] %= 2;
    if (bit[i] == -1) {
      bit[i] = 1;
      bit[i + 1]--;
    }
    if (bit[i]) {
      if (l == -1) l = i;
      r = i;
    }
  }
  long long t = 0, tk = k << 1;
  for (int i = r; i >= l; i--) {
    t += bit[i];
    if (t > tk) {
      puts("0");
      return 0;
    }
    t <<= 1;
  }
  int p = l;
  t >>= 1;
  int ans = 0;
  while (p >= 0 && t <= tk) {
    if (p <= n) {
      long long tt = abs(a[p] * sig - t);
      if (tt <= k) ans++;
      if (p == n && tt == 0) ans--;
    }
    t <<= 1;
    p--;
  }
  printf("%d\n", ans);
}
