#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200005];
int bit[300005], _bit;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = int(0); i < int(n + 1); i++) scanf("%d", a + i);
  _bit = 0;
  for (int i = int(0); i < int(n + 1); i++) {
    int A = a[i];
    for (int j = i; A; j++) {
      bit[j] += A % 2;
      A /= 2;
      _bit = max(_bit, j + 1);
    }
  }
  for (int i = int(0); i < int(_bit); i++) {
    bit[i + 1] += bit[i] / 2;
    bit[i] %= 2;
  }
  while (bit[_bit] != 0) {
    bit[_bit + 1] = bit[_bit] / 2;
    bit[_bit] %= 2;
    _bit++;
  }
  while (bit[_bit - 1] == 0) _bit--;
  int ope = bit[_bit - 1], borrow = 0;
  for (int i = int(0); i < int(_bit); i++) {
    bit[i] *= ope;
    if (borrow) {
      bit[i]--;
      borrow = 0;
    }
    if (bit[i] < 0) {
      bit[i] += 2;
      borrow = 1;
    }
  }
  while (bit[_bit - 1] == 0) _bit--;
  long long K = 0;
  int low = 0, ans = 0;
  while (bit[low] == 0) low++;
  for (int i = _bit - 1; i >= 0; i--) {
    K = K * 2 + bit[i];
    if (K > 2L * k) {
      break;
    }
    if (i <= n) {
      long long tmpa = a[i] * 1LL - K * ope;
      if (tmpa >= -1LL * k && tmpa <= 1LL * k && i <= low && (i < n || tmpa)) {
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
