#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200100] = {};
int main() {
  scanf("%d%d", &n, &k), ++n;
  for (int i = 0; i < (int)(n); ++i) scanf("%d", a + i);
  long long sum = 0;
  int badBit = -1;
  for (int i = 0; i < (int)(12341234); ++i) {
    sum += a[i];
    if (sum % 2 != 0) {
      badBit = i;
      break;
    }
    sum /= 2;
  }
  sum = 0;
  for (int i = n - 1; i >= 0; --i) {
    sum *= 2;
    sum += a[i];
    if (i >= badBit && abs(sum) > 3.1e9) {
      printf("0\n");
      return 0;
    }
    if (i == max(0, badBit - 31)) {
      long long res = abs(sum) >> (badBit - i);
      if (i < badBit && (abs(sum) & (1ll << (badBit - i - 1)))) {
        ++res;
      }
      if (sum > 0) res *= -1;
      int ans = 0;
      for (int j = badBit; j >= 0; --j) {
        if (abs(res) > 2.1e9) break;
        if (j < n && abs(res + a[j]) <= k) ++ans;
        if (j == n - 1 && abs(res + a[j]) == 0) --ans;
        res *= 2;
      }
      printf("%d\n", ans);
      return 0;
    }
  }
  return 0;
}
