#include <bits/stdc++.h>
using namespace std;
const long long N = 200001;
long long a[N];
long long b[N];
long long c[N];
int main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i <= n; i++) {
    cin >> a[i];
  }
  b[n] = a[n];
  long long right = 0;
  for (long long i = n - 1; i >= 0; i--) {
    b[i] = a[i] + 2 * b[i + 1];
    if (b[i] > n * k || b[i] < -n * k) {
      right = i;
      break;
    }
  }
  long long left = n;
  long long cur_val = a[0];
  c[0] = a[0];
  for (long long i = 1; i <= n; i++) {
    if (cur_val % 2 != 0) {
      left = i - 1;
      break;
    } else {
      cur_val /= 2;
      cur_val += a[i];
      c[i] = cur_val;
    }
  }
  long long ans = 0;
  for (long long i = right; i <= left; i++) {
    long long x = c[i] + b[i] - 2 * a[i];
    if (i == n) {
      if (x != 0) {
        ans++;
      }
    } else {
      if (abs(x) <= k) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
