#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
const int MAXN = 2e5 + 5;
const int MAXM = 1e3 + 5;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const ll LLINF = 2e18;
const long double EPS = 1e-8;
ll m, n, k, ans, last, val;
ll a[MAXN], dif[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n + 1; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n + 1; i++) {
    val += a[i];
    dif[i] = val;
    if (val & 1) {
      break;
    }
    last++;
    val /= 2;
  }
  val = 0;
  for (int i = n; i >= 0; i--) {
    if (i <= last) {
      ll nw = a[i] - (val * 2 + dif[i]);
      if (abs(nw) <= k && (nw != 0 || i != n)) {
        ans++;
      }
    }
    val = val * 2 + a[i];
    if (abs(val) > INF) {
      break;
    }
  }
  cout << ans << '\n';
  return 0;
}
