#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
long long a[N];
long long b[N];
long long n, k, m, ans;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 0; i <= n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  m = n;
  long long mn = -1;
  long long mx = 0;
  for (long long i = 0; i <= m; i++) {
    if (abs(b[i]) > 1) {
      b[i + 1] += b[i] / 2;
      b[i] %= 2;
      if (i == m) m++;
    }
    if (b[i]) {
      if (mn < 0) mn = i;
      mx = i;
    }
  }
  if (mn < 0) return cout << 0, 0;
  for (long long i = 0; i <= min(mn, n); i++) {
    bool ok = true;
    long long need = 0;
    for (long long j = mx; j >= i; j--) {
      need = need * 2 + b[j];
      if (abs(a[i] - need) > k) {
        ok = false;
        break;
      }
    }
    if (i == n && a[i] == need) continue;
    ans += ok;
  }
  cout << ans;
  return 0;
}
