#include <bits/stdc++.h>
using namespace std;
int z[200001];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i <= n; i++) scanf("%d", z + i);
  long long ss = 0;
  vector<int> pos;
  bool neg = false;
  {
    long long s = 0;
    for (int i = 0; i <= n; i++) {
      s += z[i];
      if (s % 2) s--, pos.push_back(i);
      s /= 2;
    }
    if (s >= 0) {
      ss = s;
    } else {
      pos.clear();
      neg = true;
    }
  }
  if (neg) {
    long long s = 0;
    for (int i = 0; i <= n; i++) {
      s += z[i];
      if (s % 2) s++, pos.push_back(i);
      s /= 2;
    }
    if (s <= 0) {
      ss = -s;
    }
  }
  for (int i = n + 1; ss; i++) {
    if (ss % 2) pos.push_back(i);
    ss /= 2;
  }
  int r = pos[0];
  if (pos[pos.size() - 1] - r > 31) {
    cout << 0;
    return 0;
  }
  if (r > n) r = n;
  long long q = 0;
  for (int p : pos) q |= 1ll << p - r;
  if (neg) q = -q;
  int s = 0;
  while (abs(q) <= 2 * k && r >= 0) {
    if (abs(z[r] - q) <= k && !(r == n && z[r] == q)) s++;
    r--;
    q *= 2;
  }
  cout << s;
}
