#include <bits/stdc++.h>
using namespace std;
const int nmax = 3 + 2 * 1e5;
const long long lim = 1e16 + 1;
long long v[nmax + 1];
long long st[nmax + 1], dr[nmax + 1];
inline long long valabs(long long x) { return (x < 0 ? -x : x); }
int main() {
  int n, k;
  fscanf(stdin, "%d%d", &n, &k);
  ++n;
  for (int i = 1; i <= n; ++i) {
    fscanf(stdin, "%I64d", &v[i]);
  }
  bool ok = 1;
  for (int i = 1; i <= n; ++i) {
    if (ok) {
      st[i] = (st[i - 1] >> 1) + v[i];
      if (st[i] & 1) {
        ok = 0;
      }
    } else {
      st[i] = lim;
    }
  }
  ok = 1;
  for (int i = n; i > 0; --i) {
    if (ok) {
      dr[i] = (dr[i + 1] << 1) + v[i];
      if (valabs(dr[i] << 1) >= lim) {
        ok = 0;
      }
    } else {
      dr[i] = lim;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (st[i] != lim && dr[i] != lim) {
      long long x = -(st[i] + dr[i] - v[i]);
      if (valabs(v[i] + x) <= k && (i != n || v[i] + x != 0)) {
        ++ans;
      }
    }
  }
  fprintf(stdout, "%d\n", ans);
  return 0;
}
