#include <bits/stdc++.h>
using namespace std;
vector<long long> g;
long long a[300100];
long long now, tmp, k;
int b, l, i, j, ans, n;
int main() {
  cin >> n >> k;
  for (i = 0; i <= n; i++) {
    scanf("%d", &b);
    a[i] = b;
    g.push_back(a[i]);
  }
  for (i = 0; i < g.size(); i++) {
    tmp = g[i];
    if (abs(tmp) <= 1) continue;
    if (i + 1 == g.size()) g.push_back(0);
    g[i + 1] += tmp / 2;
    g[i] %= 2;
  }
  while (l < g.size() && g[l] == 0) l++;
  for (i = g.size() - 1; i >= 0; i--) {
    now = now * 2 + g[i];
    if (abs(now) > (1LL << 35)) break;
    if (i > l) continue;
    if (i > n) continue;
    if (i == n && a[i] == now) continue;
    if (abs(1LL * a[i] - now) <= k) ans++;
  }
  cout << ans << endl;
}
