#include <bits/stdc++.h>
using namespace std;
bitset<200005> frontdead;
long long co[200005], nco[200005], Q[200005], mid[200005];
int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 0; i <= n; ++i) {
    cin >> co[i];
    nco[i] = co[i];
  }
  int ans = 0;
  Q[n] = co[n];
  for (int i = n - 1; i >= 0; --i) {
    if (frontdead[i + 1]) frontdead[i] = 1;
    mid[i] = Q[i + 1] * 2;
    Q[i] = co[i] + mid[i];
    if (abs(Q[i]) > (long long)4e9) {
      frontdead[i] = 1;
    }
  }
  for (int i = 0; i <= n; ++i) {
    if (!frontdead[i]) {
      long long target = -mid[i];
      long long delta = nco[i] - target;
      long long ornco = co[i] - delta;
      if (i != n && abs(ornco) <= k)
        ++ans;
      else if (i == n && abs(ornco) <= k && ornco != 0)
        ++ans;
    }
    if (nco[i] & 1) break;
    nco[i] >>= 1;
    nco[i + 1] += nco[i];
  }
  cout << ans << endl;
}
