#include <bits/stdc++.h>
using namespace std;
const long long N = 200009, INF = (1LL << 50);
long long n, k, ans, a[N], b[N], c[N];
int main() {
  scanf("%I64d %I64d", &n, &k);
  for (long long i = (0); i <= (n); i++) scanf("%I64d", &a[i]);
  for (long long i = 1; i <= (n); i++) b[i] = c[i] = INF;
  b[n] = a[n];
  for (long long i = (n); i >= (1); i--) {
    b[i - 1] = a[i - 1] + b[i] * 2;
    if (abs(b[i - 1]) > k * 2) break;
  }
  c[0] = a[0];
  for (long long i = (0); i <= (n - 1); i++) {
    if (c[i] % 2 != 0) break;
    c[i + 1] = a[i + 1] + c[i] / 2;
  }
  for (long long i = (n); i >= (0); i--) {
    long long v = 0;
    bool flag = true;
    if (i < n) {
      if (abs(b[i + 1]) > k * 2)
        flag = false;
      else
        v = b[i + 1] * 2;
    }
    if (i > 0) {
      if (c[i - 1] == INF)
        flag = false;
      else {
        if (c[i - 1] % 2 != 0)
          flag = false;
        else
          v += c[i - 1] / 2;
      }
    }
    if (flag && abs(v) <= k) ans++;
    if (flag && i == n && v == 0) ans--;
  }
  printf("%I64d\n", ans);
  return 0;
}
