#include <bits/stdc++.h>
using namespace std;
long long arr[200001];
long long pref[200001];
bool used[200001];
int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 0; i <= n; i++) cin >> arr[i];
  long long cnt = 0;
  long long answer = 0;
  for (int i = 0; i <= n; i++) {
    if (cnt == 0 && i == n) break;
    if (cnt & 1 == 1) break;
    used[i] = true;
    pref[i] = cnt;
    cnt /= 2;
    cnt += arr[i];
  }
  cnt = 0;
  for (int i = n; i >= 0; i--) {
    if (abs(cnt) > k) break;
    cnt *= 2;
    if (used[i]) {
      if (abs(pref[i] / 2 + cnt) <= k) answer++;
    }
    cnt += arr[i];
  }
  cout << answer << '\n';
}
