#include <bits/stdc++.h>
using namespace std;
const int nax = 1e6 + 5;
int t[nax];
long long pref[nax], suf[nax];
const long long WRONG = 1e10 + 5;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; ++i) scanf("%d", &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] = WRONG;
      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]) >= WRONG) {
      for (int j = i - 1; j >= 0; --j) suf[j] = WRONG;
      break;
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; ++i)
    if (suf[i] != WRONG && pref[i] != WRONG) {
      long long maybe = (pref[i] + suf[i]);
      if (maybe == 0 && i == n) continue;
      if (abs(maybe) <= k) ++ans;
    }
  printf("%d\n", ans);
  return 0;
}
