#include <bits/stdc++.h>
using namespace std;
int a[200010];
int c[200010];
int main() {
  int n, k;
  while (cin >> n >> k) {
    c[0] = 0;
    for (int i = 0; i <= n; i++) {
      scanf("%d", &a[i]);
      c[i + 1] = (a[i] + c[i]) / 2;
      c[i] = (a[i] + c[i]) % 2;
    }
    int pos = 0;
    while (c[pos] == 0) {
      pos++;
    }
    int ans = 0;
    long long value = -c[n + 1];
    for (int i = n; i >= 0; i--) {
      value = value * 2 - c[i];
      if (i <= pos && abs(value + a[i]) <= k) {
        if (i != n || value + a[i] != 0) ans++;
      }
      if (abs(value) > 2 * k) break;
    }
    cout << ans << endl;
  }
  return 0;
}
