#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2e5 + 100;
long long n, k, a[maxn], b[maxn], l, r, ans;
bool f(int pos) {
  if (pos > n + 4 && b[pos] == -1) return false;
  if (b[pos] % 2 == 0) {
    b[pos + 1] += b[pos] / 2;
    b[pos] = 0;
  } else {
    b[pos + 1] += (b[pos] - 1) / 2;
    b[pos] = 1;
  }
  return true;
}
bool t(int pos) {
  long long answer = 0, f = 1;
  for (int i = pos; i <= l; i++) {
    answer += b[i] * f;
    f *= 2;
    if (answer > 1e10) break;
  }
  if (abs(a[pos] - answer) <= k && pos <= n &&
      ((a[pos] - answer) != 0 || pos != n))
    return true;
  return false;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n + 1; i++) cin >> a[i];
  for (int i = 0; i < n + 1; i++) b[i] = a[i];
  for (int i = 0; i < n + 40; i++)
    if (!f(i)) {
      for (int j = 0; j < n + 40; j++) {
        a[j] = -a[j];
        b[j] = a[j];
      }
      for (int j = 0; j < n + 40; j++) f(j);
      break;
    }
  r = -1;
  for (int i = 0; i < n + 40; i++) {
    if (b[i] == 1 && r == -1) r = i;
    if (b[i] == 1) l = i;
  }
  for (int i = r; i > l - 40 && i >= 0; i--)
    if (t(i)) {
      ans++;
    }
  cout << ans;
  return 0;
}
