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