#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, k;
int a[N];
const int NN = N * 32 + 474;
int p[NN + 1];
int sign(int x) {
  if (x < 0) return -1;
  return 1;
}
void add(int x, int pos) {
  int sgn = sign(x);
  x = abs(x);
  while (x) {
    p[pos++] += sgn * (x & 1);
    x >>= 1;
  }
}
void normalize(int l, int r) {
  int carry = 0;
  for (int i = l; i < r || carry; i++) {
    p[i] += carry;
    int sgn = sign(p[i]);
    p[i] = abs(p[i]);
    carry = p[i] >> 1;
    p[i] &= 1;
    carry *= sgn;
    p[i] *= sgn;
  }
}
bool ok(int l, int r) {
  for (int(i) = (l); i < (r); ++(i))
    if (p[i]) return 0;
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> k;
  ++n;
  for (int(i) = (0); i < (n); ++(i)) {
    cin >> a[i];
    add(a[i], i);
  }
  normalize(0, NN);
  int l = 0;
  while (l < NN && p[l] == 0) ++l;
  int r = NN;
  while (p[r] == 0 && r >= 0) --r;
  int ans = 0;
  long long w = 0;
  for (int i = r; i >= l; i--) {
    w *= 2;
    w += p[i];
    if (abs(w) > 1e+15) {
      cout << 0;
      return 0;
    }
  }
  for (int i = l; i >= 0; i--) {
    long long v = w - a[i];
    if (abs(v) <= k && i < n && !(i == n - 1 && v == 0)) {
      ans++;
      cerr << i << " " << v << endl;
    }
    w *= 2;
    if (abs(w) > 1e+15) break;
  }
  cout << ans;
}
