#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int N = 200000 + 5;
int aa[N], Ans = 0, n, k;
long long a[N], p[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) scanf("%d", &aa[i]), a[i] = aa[i];
  long long t = 0;
  int mn = n;
  for (int i = n; i >= 0; i--) {
    t += t;
    if (abs(t) >= 2 * k) break;
    p[i] = t;
    mn = i;
    t += a[i];
  }
  t = 0;
  for (int i = 0; i <= n; i++) {
    if (i >= mn) {
      long long t2 = -p[i] - t;
      if (abs(t2) <= k && !(i == n && t2 == 0)) {
        Ans++;
      }
    }
    t = t + a[i];
    if (t % 2 == 1 || t % 2 == -1) break;
    t /= 2;
  }
  printf("%d\n", Ans);
  return 0;
}
