#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int a[n + 1], b[n + 100];
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n + 100; i++) b[i] = 0;
  int first = 0x7FFFFFFF;
  int ind = 0;
  int now = 0;
  while (ind <= n || abs(now) > 1) {
    if (ind <= n) now += a[ind];
    b[ind] = abs(now) % 2;
    if (b[ind] != 0) first = min(first, ind);
    now = (now - b[ind]) / 2;
    ind++;
  }
  if (now != 0) {
    b[ind] = now;
    first = min(first, ind);
  }
  int res = 0;
  long long val = 0;
  for (int i = ind; i >= min(n, first); i--) {
    val = 2 * val;
    val += b[i];
    if (val < ((long long)-2 * k) || val > ((long long)2 * k)) goto finish;
  }
  for (int i = min(n, first); i >= 0; i--) {
    if ((a[i] - val != 0ll || i != n) && a[i] - val <= ((long long)k) &&
        a[i] - val >= ((long long)-k))
      res++;
    val *= 2;
    if (val < ((long long)-2 * k) || val > ((long long)2 * k)) goto finish;
  }
finish:
  cout << res;
}
