#include <bits/stdc++.h>
using namespace std;
int n, sum[300000], a[300000];
bool v[300000];
int judge(int j, int x, int k) {
  if (v[j + 50]) return 0;
  int i;
  long long temp = 0;
  for (i = j + 60; i >= j; i--) temp = temp * 2 + sum[i];
  if ((j != n || x - temp) && x - temp >= -k && x - temp <= k) return 1;
  return 0;
}
int main() {
  int k, i, j, flag, ans = 0, x, sig, big = 0;
  cin >> n >> k;
  for (i = 0; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] < 0)
      x = -a[i], sig = -1;
    else
      x = a[i], sig = 1;
    for (j = i; x; j++, x >>= 1) sum[j] += sig * (x & 1);
  }
  for (i = 0; i <= 250000; i++) {
    while (sum[i] <= -2) sum[i] += 2, sum[i + 1]--;
    while (sum[i] >= 2) sum[i] -= 2, sum[i + 1]++;
    if (sum[i]) big = i;
  }
  for (; big >= 1; big--) {
    if (sum[big] == -1 && sum[big - 1] == 1)
      sum[big] = 0, sum[big - 1] = -1;
    else if (sum[big] == 1 && sum[big - 1] == -1)
      sum[big] = 0, sum[big - 1] = 1;
    else
      break;
  }
  for (i = 250000; i >= 0; i--) v[i] = v[i + 1] | (sum[i] != 0);
  flag = 1;
  for (i = 0; i <= n; i++) {
    if (i > 0 && sum[i - 1]) flag = 0;
    if (!flag) break;
    if (judge(i, a[i], k)) ans++;
  }
  cout << ans;
  return 0;
}
