#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long double EPS = 1e-8;
const long double PI = acos(-1.0);
const int MAXN = 2e5 + 1000;
int a[MAXN];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = int(0); i < int(n + 1); ++i) scanf("%d", &a[i]);
  int mx = n;
  long long inf = ((long long)1000) * k;
  long long down = 0;
  for (int i = int(0); i < int(n + 1); ++i) {
    down += a[i];
    if (down % 2 != 0) {
      mx = i;
      break;
    }
    if (i < n) down /= 2;
  }
  bool fail = false;
  long long rem = 0;
  for (int i = n; i > mx; --i) {
    rem += a[i];
    rem *= 2;
    if (abs(rem) > inf) {
      fail = true;
      break;
    }
  }
  if (fail) {
    cout << 0 << '\n';
    return 0;
  }
  long long ans = 0;
  rem += down;
  for (int i = mx; i >= 0; --i) {
    if (abs(a[i] - rem) <= k) {
      if (a[i] - rem != 0 || i != n) ans++;
    }
    rem *= 2;
    if (abs(rem) > inf) break;
  }
  cout << ans << '\n';
  return 0;
}
