#include <bits/stdc++.h>
using namespace std;
long long INF = 1LL << 50;
int n;
int k;
long long a[200001];
long long rg[200001];
long long lf[200001];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
  }
  lf[0] = 0;
  for (int i = 1; i <= n; i++) {
    if ((lf[i - 1] == INF) || ((abs(lf[i - 1] + a[i - 1])) & 1))
      lf[i] = INF;
    else
      lf[i] = (lf[i - 1] + a[i - 1]) / 2;
  }
  rg[n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (rg[i + 1] == INF || (abs(rg[i + 1] + a[i + 1]) * 2 >= INF))
      rg[i] = INF;
    else
      rg[i] = (rg[i + 1] + a[i + 1]) * 2;
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    if (lf[i] == INF) continue;
    if (rg[i] == INF) continue;
    if (abs(lf[i] + rg[i]) <= k) {
      if (i != n || lf[i] + rg[i] != 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
