#include <bits/stdc++.h>
using namespace std;
long long a[200000], b[200000];
int main() {
  int n, k;
  cin >> n >> k;
  n++;
  for (int i = 0; i < n; i++) cin >> a[i];
  int up = 0;
  long long prefix_sum = 0;
  for (int i = 0; i < n; i++) {
    prefix_sum += a[i];
    b[i] = prefix_sum;
    if (prefix_sum % 2 != 0) break;
    prefix_sum /= 2;
    up++;
  }
  int ways = 0;
  long long suffix_sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (i <= up) {
      long long total_sum = 2 * suffix_sum + b[i];
      long long delta = total_sum - a[i];
      if (-k <= delta && delta <= k && (i != n - 1 || delta != 0)) ways++;
    }
    suffix_sum = 2 * suffix_sum + a[i];
    if (suffix_sum > k || suffix_sum < -k) break;
  }
  cout << ways;
}
