#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const long long INF = 2e18;
long long a[maxn], b[maxn];
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) scanf("%I64d", &a[i]);
  b[n] = a[n];
  for (int i = 0; i < n; i++) {
    long long t = b[i] + a[i];
    b[i + 1] += t / 2;
    b[i] = t % 2;
  }
  int rec = 0;
  for (int i = 0; i <= n; i++)
    if (b[i]) {
      rec = i;
      break;
    }
  int ans = 0;
  long long res = 0;
  for (int i = n; i >= 0; i--) {
    res = res * 2 + b[i];
    if (res > INF || res < -INF) break;
    if (i <= rec) {
      long long t = a[i] - res;
      if (t <= k && t >= -k && (t != 0 || i != n)) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
