#include <bits/stdc++.h>
using namespace std;
int a, d, h, k;
int arr[1000020];
long long H[1000020];
int main() {
  cin >> a >> k;
  a++;
  for (int i = 1; i <= a; i++) cin >> arr[i];
  int mini = a + 1;
  long long t = 0;
  for (int i = a; i >= 1; i--) {
    t += arr[i];
    t *= 2;
    if (t <= -2 * k || t >= 2 * k) break;
    H[i] = t;
    mini = i;
  }
  t = 0;
  int ans = 0;
  for (int i = 1; i <= a; i++) {
    if (i + 1 >= mini) {
      long long h = -H[i + 1] - t;
      if (abs(h) <= k && !(i == a && h == 0)) ans++;
    }
    t += arr[i];
    if (t % 2 == 1 || t % 2 == -1) break;
    t /= 2;
  }
  cout << ans << "\n";
}
