#include <bits/stdc++.h>
using namespace std;
long long bigpow(long long a, long long b, long long MO) {
  long long res = 1;
  a %= MO;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % MO;
    a = a * a % MO;
  }
  return res;
}
const long long m1 = 1000000007LL, m2 = 1000000009LL;
long long inv(long long c, long long MO) { return bigpow(c, MO - 2, MO); }
int main() {
  vector<long long> p1, p2;
  p1.push_back(1LL);
  p2.push_back(1LL);
  long long n, kk;
  cin >> n >> kk;
  for (int i = 1; i <= n; i++) {
    p1.push_back(p1.back() * 2 % m1);
    p2.push_back(p2.back() * 2 % m2);
  }
  int a[n + 5];
  for (int i = 0; i <= n; i++) scanf("%d", &a[i]);
  long long ans1 = 0, ans2 = 0;
  for (int i = 0; i <= n; i++) {
    ans1 += p1[i] * 1LL * a[i];
    ans1 %= m1;
    ans2 += p2[i] * 1LL * a[i];
    ans2 %= m2;
  }
  long long cnt = 0;
  for (int i = 0; i <= n; i++) {
    long long co = (p1[i] * a[i]) % m1;
    long long numer = ans1 - co;
    while (numer < 0) numer += m1;
    numer %= m1;
    long long k = numer * inv(p1[i], m1) % m1;
    if (k * p1[i] % m1 != numer % m1) continue;
    k *= -1;
    long long co2 = (p2[i] * a[i]) % m2;
    long long numer2 = (ans2 - co2);
    while (numer2 < 0) numer2 += m2;
    numer2 %= m2;
    long long cand1 = k, cand2 = (k + m1) % m1;
    if (i == n) {
      if (cand1 == 0) cand1 = 1 + k;
      if (cand2 == 0) cand2 = 1 + k;
    }
    if (llabs(cand1) <= kk and (numer2 + cand1 * p2[i]) % m2 == 0) cnt++;
    if (cand1 != cand2 and llabs(cand2) <= kk and
        (numer2 + cand2 * p2[i]) % m2 == 0)
      cnt++;
  }
  cout << cnt << endl;
}
