#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128000000")
using namespace std;
const int MAXN = 3e5 + 200;
const int INF = int(1e9) + 7;
const long long LINF = 1LL * 4e9;
const int md = int(1e9) + 7;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;
int n, k;
int a[MAXN], res[MAXN];
long long val[MAXN];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) {
    scanf("%d", &a[i]);
    res[i] = a[i];
  }
  int power = -1;
  for (int i = 0; i <= n + 300; i++) {
    res[i + 1] += res[i] / 2;
    res[i] %= 2;
    if (res[i]) {
      power = i;
    }
  }
  if (power == -1) {
    printf("0\n");
    return 0;
  }
  int sign = res[power] > 0 ? 1 : -1;
  for (int i = 0; i <= power; i++) {
    res[i] *= sign;
  }
  for (int i = power; i >= 0; i--) {
    if (res[i] < 0) {
      for (int j = i;; j++) {
        if (res[j] > 0) {
          res[j] = 0;
          break;
        }
        res[j] = 1;
      }
    }
  }
  while (!res[power]) {
    power--;
  }
  for (int i = power; i >= 0; i--) {
    val[i] = val[i + 1] * 2 + res[i];
    val[i] = min(val[i], LINF);
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    if (val[i] != LINF) {
      int left = 0;
      int right = (sign == 1 ? abs(-a[i] - k) : k - a[i]);
      if (val[i] >= left && val[i] <= right) {
        ans++;
      }
      if (i == n) {
        if (sign == 1 && val[n] == a[n]) {
          ans--;
        }
        if (sign == -1 && val[n] == -a[n]) {
          ans--;
        }
      }
    }
    if (res[i]) {
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}
