#include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
long long num[maxn];
long long lef[maxn];
int n, k;
const long long INF = 1e18;
int main() {
  scanf("%d%d", &n, &k);
  memset(lef, 0, sizeof(lef));
  for (int i = 0; i <= n; ++i) {
    scanf("%I64d", &num[i]);
    lef[i] = num[i];
  }
  int cnt;
  for (cnt = 0; cnt < n; ++cnt) {
    if (lef[cnt] & 1) break;
    lef[cnt + 1] += lef[cnt] / 2;
    lef[cnt] = 0;
  }
  int ans = 0;
  if (cnt == n && abs(lef[n] - num[n] <= k) && (lef[n] != num[n])) ++ans;
  for (int i = n; i > 0; --i) {
    if (lef[i] > INF || lef[i] < -INF) break;
    lef[i - 1] += lef[i] * 2;
    if (i <= cnt + 1) {
      if (abs(lef[i - 1] - num[i - 1]) <= k) ++ans;
    }
  }
  printf("%d\n", ans);
}
