#include <bits/stdc++.h>
const int maxn = 200005, INF = 1e18;
long long t[maxn], a[maxn], b[maxn];
int main(void) {
  int n, k;
  long long res = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) {
    scanf("%I64d", &a[i]);
  }
  b[n] = a[n];
  int flag;
  for (int i = 0; i < n; i++) {
    int tmp = b[i] + a[i];
    b[i + 1] += tmp / 2ll;
    b[i] = tmp % 2ll;
  }
  for (int i = 0; i <= n; i++) {
    if (b[i]) {
      flag = i;
      break;
    }
  }
  int cnt = 0;
  for (int i = n; i >= 0; i--) {
    res = res * 2ll + b[i];
    if (res > INF || res < -INF) break;
    if (i <= flag) {
      int ans = a[i] - res;
      if (ans >= -k && ans <= k && (ans != 0 || i != n)) {
        cnt++;
      }
    }
  }
  printf("%d\n", cnt);
}
