#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[200001];
long long b[200001];
long long rev[200001];
bool ok[200001];
bool ok2[200001];
int main() {
  for (int i = 0; i < 200001; i++) ok[i] = true;
  for (int i = 0; i < 200001; i++) ok2[i] = true;
  scanf("%I64d%I64d", &n, &k);
  n++;
  for (int i = 0; i < n; i++) scanf("%I64d", a + i);
  for (int i = 0; i < n; i++) b[i] = a[i];
  for (int i = 0; i < n; i++) rev[i] = a[i];
  for (int i = 1; i < n; i++) {
    if (!ok[i - 1]) {
      ok[i] = false;
      continue;
    }
    if (abs(b[i - 1]) % 2 == 1) {
      ok[i] = false;
    } else {
      b[i] += b[i - 1] / 2;
    }
  }
  for (int i = n - 2; i >= 0; i--) {
    if (!ok2[i + 1]) {
      ok2[i] = false;
      continue;
    }
    rev[i] += rev[i + 1] * 2;
    if (abs(rev[i]) > k * 5) {
      ok2[i] = false;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (ok[i] == false || ok2[i] == false) continue;
    if (abs(rev[i] + b[i] - a[i] * 2) > k) continue;
    if (abs(rev[i] + b[i] - a[i] * 2) == 0 && i == n - 1) continue;
    ans++;
  }
  cout << ans << endl;
}
