#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  n++;
  vector<long long> start;
  vector<long long> v;
  int ans = 0;
  long long st;
  for (int i = 0; i < n; ++i) {
    long long num;
    cin >> num;
    v.push_back(num);
    start.push_back(num);
  }
  st = v[n - 1];
  int step = n - 1;
  for (int i = 0; i < n; ++i) {
    if (v[i] % 2 != 0) {
      step = i;
      break;
    } else if (i + 1 != n)
      v[i + 1] += v[i] / 2;
  }
  long long num = 0;
  for (int i = n - 1; i >= step; --i) {
    num = num * 2 + v[i];
    if (abs(num - start[i]) > k && abs(num) > k) {
      cout << 0;
      return 0;
    }
  }
  for (int j = step; j >= 0; --j) {
    if (step != n - 1 || num != st)
      if (abs(num - start[j]) <= k) {
        ans++;
      }
    if (abs(num) > k) break;
    num *= 2;
  }
  cout << ans << endl;
  return 0;
}
