#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  vector<long long> cum(n + 2, k + 1);
  for (int i = 0; i < n + 1; i++) {
    int x;
    scanf("%d", &x);
    a[i] = x;
  }
  cum[n + 1] = 0;
  cum[n] = a[n];
  for (int i = n - 1; i >= 0; i--) {
    cum[i] = 2 * cum[i + 1] + a[i];
    if (abs(cum[i]) > k) break;
  }
  int ans = 0;
  long long last = 0;
  for (int i = 0; i <= n; i++) {
    long long val = 2 * cum[i + 1] + last;
    if (abs(val) <= k && (val != 0 || i != n)) {
      ans++;
    }
    last = (a[i] + last);
    if (last & 1) break;
    last /= 2;
  }
  printf("%d\n", ans);
  return 0;
}
