#include <bits/stdc++.h>
using namespace std;
long long i, j, n, k, q, a[228228], b[228228], x, y, d, h;
long long Abs(long long x) { return x > 0 ? x : -x; }
int main() {
  cin >> n >> x;
  for (i = 0; i <= n; i++) {
    scanf("%I64d", &a[i]);
    b[i] = a[i];
  }
  for (i = 0; i < n; i++) {
    if (b[i] % 2 != 0) break;
    b[i + 1] += b[i] / 2;
  }
  k = i;
  long long val = 0;
  for (i = n; i >= k; i--) {
    val = val * 2 + b[i];
    if (Abs(val) > 2 * x) {
      cout << 0 << endl;
      return 0;
    }
  }
  while (Abs(val) <= 2 * x && k > 0) {
    k--;
    val *= 2;
  }
  long long ans = 0;
  for (i = k; i <= n; i++) {
    if (i == n && a[i] - val == 0) break;
    if (Abs(a[i] - val) <= x) {
      ans++;
    }
    if (val % 2 != 0) break;
    val /= 2;
  }
  cout << ans << endl;
  return 0;
}
