#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int MAXN = 200150;
long long n, k;
long long mas[MAXN];
long long org[MAXN];
void solve() {
  cin >> n >> k;
  for (int i = 0; i <= n; ++i) {
    cin >> mas[i];
    org[i] = mas[i];
  }
  for (int i = 0; i <= n; ++i) {
    int t = mas[i] / 2;
    mas[i] = mas[i] % 2;
    if (mas[i] < 0) {
      mas[i] = 1;
      t--;
    }
    mas[i + 1] += t;
  }
  long long os = mas[n + 1];
  int pos = n;
  for (int i = 0; i <= n; ++i) {
    if (mas[i]) {
      pos = i;
      break;
    }
  }
  for (int i = n; i > pos; --i) {
    os = os * 2;
    os += mas[i];
    if (abs(os) > 3 * k) break;
  }
  int ans = 0;
  for (int i = pos; i >= 0; --i) {
    os *= 2;
    os += mas[i];
    if (abs(os) > 3 * k) break;
    if (abs(os - org[i]) <= k) {
      if (i != n || (os - org[i]) != 0) ans++;
    }
  }
  cout << ans;
}
int main() {
  srand(1313);
  solve();
  return 0;
}
