#include <bits/stdc++.h>
using namespace std;
const long long N = 200111;
const long long inf = 1L << 60;
long long n, k;
long long a[N];
long long b[N];
int main() {
  while (cin >> n >> k) {
    for (long long i = 0; i <= n; i++) {
      cin >> a[i];
      b[i] = a[i];
    }
    for (long long i = 0; i < n; i++) {
      b[i + 1] += b[i] / 2;
      b[i] %= 2;
    }
    long long deep = 0;
    for (long long i = 0; i <= n; i++) {
      if (b[i]) {
        deep = i;
        break;
      }
    }
    long long ans = 0;
    long long sum = 0;
    for (long long i = n; i >= 0; i--) {
      sum *= 2;
      sum += b[i];
      if (abs(sum) > 1e10) break;
      if (i <= deep) {
        long long t = abs(a[i] - sum);
        if (i != n && t <= k || i == n && t <= k && t) ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
