#include <bits/stdc++.h>
using namespace std;
long long const N = 2e5 + 70;
long long n, k, a[N], cnt[N], ans, fi = -1, la = -1;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 0; i <= n; i++) {
    cin >> a[i];
    cnt[i] = a[i];
  }
  for (long long i = 0; i < n + 50; i++) {
    if (cnt[i] < 0) {
      cnt[i + 1] += cnt[i];
      cnt[i] = -cnt[i];
    }
    cnt[i + 1] += cnt[i] / 2;
    cnt[i] &= 1;
    if (cnt[i]) {
      if (fi == -1) fi = i;
      la = i;
    }
  }
  if (cnt[n + 50]) {
    fi = la = -1;
    memset(cnt, 0, sizeof cnt);
    for (long long i = 0; i <= n; i++) a[i] = -a[i], cnt[i] = a[i];
    for (long long i = 0; i < n + 50; i++) {
      if (cnt[i] < 0) {
        cnt[i + 1] += cnt[i];
        cnt[i] = -cnt[i];
      }
      cnt[i + 1] += cnt[i] / 2;
      cnt[i] &= 1;
      if (cnt[i]) {
        if (fi == -1) fi = i;
        la = i;
      }
    }
  }
  if (la - fi >= 35) return cout << "0\n", 0;
  long long res = 0;
  for (long long i = fi; i <= la; i++) res += (1 << (i - fi)) * cnt[i];
  long long cur = res;
  for (long long i = fi; i >= 0 && cur <= 2e9; i--) {
    if (i <= n && a[i] - cur >= -k && (i != n || a[i] - cur != 0)) ans++;
    cur *= 2;
  }
  cout << ans << '\n';
}
