#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int inf = 50000000;
const int maxn = 200010;
long long abso(long long x) {
  if (x < 0) return (x * (-1ll));
  return x;
}
long long a[maxn], y[maxn], z[maxn];
int main() {
  int i, j, n, fc, ans = 0;
  long long k, lim, temp;
  scanf("%d%lld", &n, &k);
  lim = 1ll << 50;
  for (i = 0; i <= n; i++) scanf("%lld", &a[i]);
  y[0] = a[0];
  fc = n;
  for (i = 1; i <= n; i++) {
    y[i] = a[i] + (y[i - 1] / 2);
    y[i - 1] = y[i - 1] % 2;
    if (y[i - 1] != 0 && fc == n) fc = i - 1;
  }
  z[n] = -y[n];
  z[n + 1] = 0;
  for (i = n - 1; i > fc; i--) {
    z[i] = -y[i] + (z[i + 1] * 2ll);
    if (abso(z[i]) > lim) {
      printf("0\n");
      return 0;
    }
  }
  for (i = fc; i >= 0; i--) {
    z[i] = -y[i] + (z[i + 1] * 2ll);
    temp = a[i] + z[i];
    if (abso(temp) <= k) {
      if (!(temp == 0 && i == n)) ans++;
    }
    if (abso(z[i]) > lim) break;
  }
  printf("%d\n", ans);
  return 0;
}
