#include <bits/stdc++.h>
using namespace std;
long long INF = 1e16;
const int MAXN = 2e5 + 5;
int n, L;
long long a[MAXN], b[MAXN], c[MAXN], k;
int main() {
  scanf("%d", &n);
  scanf("%lld", &k);
  for (int i = 0; i < (int)n + 1; i++) scanf("%lld", &a[i]);
  b[0] = -a[0];
  for (int i = 1; i < (int)n + 1; i++) {
    if (b[i - 1] % 2) break;
    L = i;
    b[i] = b[i - 1] / 2 - a[i];
  }
  c[n - 1] = a[n] * 2;
  for (int i = n - 1; i > (int)0; i--) {
    c[i - 1] = 2 * (c[i] + a[i]);
    if (c[i - 1] > INF) c[i - 1] = INF;
    if (c[i - 1] < -INF) c[i - 1] = -INF;
  }
  int ans = 0;
  for (int i = 0; i < (int)L + 1; i++) {
    if (c[i] == INF || c[i] == -INF) continue;
    if (abs(a[i] + b[i] - c[i]) <= k && i != n) ans++;
  }
  if (L == n && b[n] != -a[n] && abs(a[n] + b[n] - c[n]) <= k) ans++;
  printf("%d\n", ans);
}
