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