#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
int cnt[212345], a[212345], v[212345];
int main() {
  memset(cnt, 0, sizeof(cnt));
  memset(a, 0, sizeof(a));
  memset(v, 0, sizeof(v));
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
    int x = a[i];
    int j = 0;
    while (x) {
      cnt[i + j] += x % 2;
      x /= 2;
      j++;
    }
  }
  int j = 0, t, f = 1;
  for (int i = 0; i <= n + 100; i++) {
    t = j + cnt[i];
    cnt[i] = t % 2;
    j = t / 2;
    if (cnt[i] < 0)
      f = -1;
    else if (cnt[i] > 0)
      f = 1;
  }
  if (f < 0)
    for (int i = 0; i <= n + 100; i++) cnt[i] *= -1;
  int fl = 0;
  for (int i = 0; i <= n + 100; i++) {
    if (fl) {
      if (cnt[i] == 1) fl = 0;
      cnt[i] = (cnt[i] + 1) % 2;
    } else {
      if (cnt[i] == -1) {
        cnt[i] = 1;
        fl = 1;
      }
    }
  }
  for (int i = 0; i <= n; i++) {
    v[i] = 1;
    if (cnt[i]) break;
  }
  int ans = 0;
  long long tp = 0;
  f *= -1;
  for (int i = n + 100; i >= 0; i--) {
    tp = tp * 2 + cnt[i] * f;
    if (abs(tp + a[i]) <= k && v[i]) {
      if (i == n && abs(tp + a[i]) == 0) continue;
      ans++;
    }
    if (abs(tp) > 2 * k) break;
  }
  cout << ans << endl;
}
