#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double E = 1e-8;
template <typename T>
inline T sqr(T t) {
  return t * t;
}
const long long INF = 1e18;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.precision(12);
  cout << fixed;
  srand(time(NULL));
  int n;
  long long k;
  cin >> n >> k;
  long long ar[n + 1];
  long long suff[n + 1], pref[n + 1];
  for (int i = 0; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i <= n; i++) suff[i] = pref[i] = LONG_LONG_MAX;
  for (int i = n; i >= 0; i--) {
    suff[i] = (i == n ? 0 : suff[i + 1]) * 2 + ar[i];
    if (abs(suff[i]) > INF) {
      suff[i] = LONG_LONG_MAX;
      break;
    }
  }
  long long sum = 0;
  if (0) {
    for (int i = 0; i <= n; i++) {
      cout << suff[i] << " ";
    }
    cout << "\n";
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    if (abs(sum) % 2 == 1) break;
    sum /= 2;
    if (!(i != n && suff[i + 1] == LONG_LONG_MAX)) {
      long long val = (i == n ? 0 : -suff[i + 1] * 2) + (i == 0 ? 0 : -sum);
      if (abs(val) <= k && (i != n || val != 0)) ans++;
      if (0) cout << val << "\n";
    }
    sum += ar[i];
  }
  cout << ans << "\n";
}
