#include <bits/stdc++.h>
using namespace std;
const int mxn = 222222;
int n, k, a[mxn];
long long suffixSum[mxn];
int main() {
  scanf("%d %d", &n, &k);
  n++;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int mnid = n + 1;
  long long cursum = 0;
  for (int i = n; i >= 1; i--) {
    cursum += a[i];
    cursum *= 2;
    if (cursum <= -2 * k || cursum >= 2 * k) break;
    suffixSum[i] = cursum;
    mnid = i;
  }
  long long prefixSum = 0;
  int ans = 0;
  cursum = 0;
  for (int i = 1; i <= n; i++) {
    if (i + 1 >= mnid) {
      cursum = -suffixSum[i + 1] - prefixSum;
      if (abs(cursum) <= k && !(i == n && cursum == 0)) ans++;
    }
    prefixSum += a[i];
    if (prefixSum % 2) break;
    prefixSum /= 2;
  }
  printf("%d\n", ans);
  return 0;
}
