#include <bits/stdc++.h>
using namespace std;
int n, k;
const int MAXN = 210200;
long long a[MAXN], nw[MAXN];
long long myabs(long long x) {
  if (x < 0) x = -x;
  return x;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) {
    scanf("%I64d", &a[i]);
  }
  long long cur = 0;
  for (int i = 0; i <= n || cur > 0; i++) {
    cur = nw[i] + a[i];
    long long c = myabs(cur);
    if (cur < 0) {
      nw[i + 1] -= c / 2;
      nw[i] = -c % 2;
    } else {
      nw[i + 1] += c / 2;
      nw[i] = c % 2;
    }
  }
  int l = 1E9;
  int r = -1;
  for (int i = 0; i < MAXN; i++) {
    if (nw[i] != 0) {
      l = min(l, i);
      r = max(r, i);
    }
  }
  long long sum = 0;
  int ans = 0;
  for (int i = r; i >= 0; i--) {
    sum = sum * 2 + nw[i];
    if (myabs(sum) > 1E15) {
      break;
    }
    if (i > l || i > n) {
      continue;
    }
    long long nwa = a[i] - sum;
    if (nwa >= -k && nwa <= k && !(i == n && nwa == 0)) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
