#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
const int maxn = (int)2e5 + 5;
const long long INF = 2e14;
long long a[maxn];
long long mods[maxn];
long long sums[maxn];
int l = 0, r = n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i <= n; i++) cin >> a[i];
  mods[0] = 0;
  int l = 0, r = n;
  for (int i = 0; i < n; i++) {
    if (((mods[i] + a[i]) % 2) != 0) {
      mods[i + 1] = INF;
      r = i;
      break;
    }
    mods[i + 1] = (mods[i] + a[i]) / 2;
  }
  sums[n] = 0;
  for (int i = n; i > 0; i--) {
    sums[i - 1] = 2 * sums[i] + a[i];
    if (abs(sums[i - 1]) > INF) {
      l = i;
      break;
    }
  }
  int ans = 0;
  for (int i = l; i <= r && i < n; i++) {
    if (abs(mods[i] + 2 * sums[i]) <= k) ans++;
  }
  if (r == n) {
    if (abs(mods[n] + 2 * sums[n]) <= k && mods[n] + 2 * sums[n] != 0) ans++;
  }
  cout << ans;
  return 0;
}
