#include <bits/stdc++.h>
using namespace std;
long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;
const long long maxn = 200005;
long long po1[maxn], in1[maxn], po2[maxn], in2[maxn];
long long base = 2;
long long power(long long a, long long n, long long mod) {
  long long t = 1;
  while (n) {
    if (n % 2) n -= 1, t = t * a % mod;
    n /= 2, a = a * a % mod;
  }
  return t;
}
long long a[200005];
pair<long long, long long> b[200005];
pair<long long, long long> tot;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  po1[0] = po2[0] = 1;
  for (long long i = 1; i <= (maxn - 1); i++) {
    po1[i] = po1[i - 1] * 2 % mod1;
    po2[i] = po2[i - 1] * 2 % mod2;
  }
  in1[maxn - 1] = power(po1[maxn - 1], mod1 - 2, mod1);
  in2[maxn - 1] = power(po2[maxn - 1], mod2 - 2, mod2);
  for (int i = maxn - 2; i >= 0; i--) {
    in1[i] = (in1[i + 1] * 2) % mod1;
    in2[i] = (in2[i + 1] * 2) % mod2;
  }
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i <= (n); i++) {
    cin >> a[i];
    b[i] = make_pair(a[i] * po1[i] % mod1, a[i] * po2[i] % mod2);
    tot = make_pair((tot.first + b[i].first) % mod1,
                    (tot.second + b[i].second) % mod2);
  }
  long long ans = 0;
  for (long long i = 0; i <= (n); i++) {
    pair<long long, long long> tmp =
        make_pair((tot.first - b[i].first + mod1) % mod1,
                  (tot.second - b[i].second + mod2) % mod2);
    tmp = make_pair((mod1 - tmp.first * in1[i]) % mod1,
                    (mod2 - tmp.second * in2[i]) % mod2);
    tmp = make_pair((tmp.first + mod1) % mod1, (tmp.second + mod2) % mod2);
    if (tmp.first <= k & tmp.second <= k && tmp.first == tmp.second) ans++;
    tmp.first -= mod1, tmp.second -= mod2;
    if (tmp.first >= -k && tmp.second >= -k && tmp.first == tmp.second) ans++;
    tmp.first += mod1, tmp.second += mod2;
    if (i == n && tmp.first == 0 && tmp.second == 0) ans--;
  }
  cout << ans;
  return 0;
}
