#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200000 + 50;
int as[MAX_N], bs[MAX_N], bnums[MAX_N];
void printv(int n, int v[]) {
  for (int i = 0; i <= n; i++) printf("%d ", v[i]);
  putchar('\n');
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) scanf("%d", as + i);
  int m = 0;
  long long co = 0;
  for (; m <= n || co != 0; m++) {
    long long a = co + (m <= n ? as[m] : 0);
    bs[m] = a - (a / 2) * 2;
    co = a / 2;
    bnums[m + 1] = bnums[m] + (bs[m] != 0 ? 1 : 0);
  }
  long long r = 0;
  int c = 0;
  for (int i = m - 1; i >= 0; i--) {
    r = r * 2 + bs[i];
    if (abs(r) > k * 2) break;
    if (i <= n && bnums[i] == 0) {
      long long d = r - as[i];
      if (abs(d) <= k && (i < n || d != 0)) c++;
    }
  }
  printf("%d\n", c);
  return 0;
}
