#include <bits/stdc++.h>
using namespace std;
long long a[200200], b[200200];
int main() {
  long long n, k, i, st, ans, tmp, now;
  while (cin >> n >> k) {
    for (i = 0; i <= n; i++) {
      scanf("%lld", &a[i]);
      b[i] = a[i];
    }
    b[n + 1] = 0;
    for (i = 0; i <= n; i++) {
      b[i + 1] += b[i] / 2;
      if (abs(b[i]) & 1 == 1)
        b[i] = (b[i] > 0 ? 1 : -1);
      else
        b[i] = 0;
    }
    st = n;
    for (i = 0; i <= n; i++) {
      if (b[i] & 1 == 1) {
        st = i;
        break;
      }
    }
    ans = 0;
    now = b[n + 1];
    for (i = n; i >= 0; i--) {
      now = (now << 1) + b[i];
      if (i <= st) {
        tmp = now - a[i];
        if (tmp < 0) tmp = -tmp;
        if (tmp <= k) ans++;
        if (tmp == 0 && i == n) ans--;
      }
      if (now > 0)
        now = min((long long)1 << 40, now);
      else if (now < 0)
        now = max(-(long long)1 << 40, now);
    }
    cout << ans << endl;
  }
}
