#include <bits/stdc++.h>
using namespace std;
long long snow[300000], snoww[300000], n, k, ans, hiest, raw[200100];
bool ne;
void splus(long long x, long long y) {
  for (long long i = 0; i < (32); ++i)
    if (x & (1 << i)) {
      ++snow[y + i];
      long long t = 0;
      while (snow[y + i + t] >= 2) {
        snow[y + i + t] -= 2;
        ++snow[y + i + (++t)];
      }
    }
}
void sminus(long long x, long long y) {
  for (long long i = 0; i < (32); ++i)
    if (x & (1 << i)) {
      ++snoww[y + i];
      long long t = 0;
      while (snoww[y + i + t] >= 2) {
        snoww[y + i + t] = 0;
        ++snoww[y + i + (++t)];
      }
    }
}
void sread() { scanf("%I64d%I64d", &n, &k); }
bool cmp() {
  for (long long i = n + 33; i >= (0); --i)
    if (snow[i] != snoww[i]) return snow[i] < snoww[i];
  return false;
}
void merge() {
  if (cmp()) swap(snow, snoww), ne = true;
  long long t = 0;
  for (long long i = 0; i <= (n + 33); ++i) {
    snow[i] -= snoww[i] + t;
    if (snow[i] < 0)
      snow[i] += 2, t = 1;
    else
      t = 0;
  }
}
void online() {
  for (long long i = 0; i <= (n); ++i) {
    scanf("%I64d", raw + i);
    if (raw[i] > 0)
      splus(raw[i], i);
    else if (raw[i] < 0)
      sminus(-raw[i], i);
  }
  merge();
}
long long sget(long long a, long long b) {
  long long ans = 0;
  for (long long i = b; i >= (a); --i) {
    ans <<= 1;
    ans += snow[i];
  }
  return ans;
}
long long sabs(long long x) { return x < 0 ? -x : x; }
bool chk(long long a, long long b, bool flg) {
  bool ok = true;
  long long tt = sget(a, b);
  if (!ne) tt = -tt;
  if (sabs(raw[a] + tt) > k) ok = false;
  if (flg)
    if (!(raw[a] + tt)) ok = false;
  return ok;
}
void solve() {
  long long t1, t2;
  for (long long i = 0; i < (n + 33); ++i)
    if (snow[i]) {
      t1 = i;
      break;
    }
  for (long long i = n + 32; i >= (0); --i)
    if (snow[i]) {
      t2 = i;
      break;
    }
  if (t2 - t1 > 32) return;
  for (long long i = max(0ll, t2 - 31), j = max(t2, 31ll); i <= t1 && i <= n;
       ++j, ++i)
    if (chk(i, j, i == n)) ++ans;
}
int main(int argc, char **argv) {
  sread();
  online();
  solve();
  printf("%I64d\n", ans);
  return 0;
}
