#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
const long long INF = 1e15 + 100;
int A[N];
long long B[N], C[N];
int main(void) {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i <= n; i++) {
    cin >> A[i];
    B[i] = 1LL * A[i];
    C[i] = 1LL * A[i];
  }
  int v = 0, u = n;
  for (int i = 0; i < n; i++) {
    if (B[i] % 2 == 0) {
      B[i + 1] += (B[i] / 2);
    } else {
      u = i;
      break;
    }
  }
  for (int i = n; i > 0; i--) {
    if (abs(C[i]) > INF) {
      v = i;
      break;
    } else {
      C[i - 1] = C[i - 1] + C[i] * 2;
    }
  }
  int cnt = 0;
  for (int i = v; i <= u; i++) {
    long long t = abs(B[i] + C[i] - 2LL * A[i]);
    if (t <= k) cnt++;
    if ((i == n) && (t == 0)) cnt--;
  }
  cout << cnt << endl;
  return 0;
}
