#include <bits/stdc++.h>
using namespace std;
int t[1000001];
long long pref[1000001], suf[1000001];
const long long inf = 1e16 + 5;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i <= n; i++) cin >> t[i];
  for (int i = 0; i < n; i++) {
    pref[i + 1] = pref[i] + t[i];
    if (pref[i + 1] % 2) {
      for (int j = i + 1; j <= n; j++) pref[j] = inf;
      break;
    } else
      pref[i + 1] /= 2;
  }
  for (int i = n; i > 0; i--) {
    suf[i - 1] = suf[i] + t[i];
    suf[i - 1] *= 2;
    if (abs(suf[i - 1]) >= inf) {
      for (int j = i - 1; j >= 0; j--) suf[j] = inf;
      break;
    }
  }
  int brojac = 0;
  for (int i = 0; i <= n; i++) {
    if (suf[i] != inf && pref[i] != inf) {
      long long maybe = -(pref[i] + suf[i]);
      if (maybe == 0 && i == n) continue;
      if (abs(maybe) <= k) brojac++;
    }
  }
  cout << brojac << endl;
  return 0;
}
