#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 6;
long long a[maxn];
long long c[maxn];
int n, flag;
long long k;
int main() {
  scanf("%d%I64d", &n, &k);
  for (int i = 0; i <= n; i++) {
    scanf("%I64d", &a[i]);
    c[i] = a[i];
  }
  for (int i = 0; i < n; i++) {
    a[i + 1] += a[i] / 2LL;
    a[i] %= 2LL;
  }
  for (int i = 0; i <= n; i++)
    if (a[i]) {
      flag = i;
      break;
    }
  long long sum = 0;
  long long ans = 0;
  for (int i = n; i >= 0; i--) {
    sum = sum * 2LL + a[i];
    if (abs(sum) > 1ll * 1e9 * 1e7) break;
    if (i <= flag) {
      long long p = c[i] - sum;
      if (abs(p) <= k) {
        if (i == n && p == 0) continue;
        ans++;
      }
    }
  }
  cout << ans << endl;
}
