#include <bits/stdc++.h>
using namespace std;
const long long N = 200000 + 10;
const long long INF = 2e9 + 10;
long long dic[N], idx[N];
int main() {
  long long n, k, ii;
  scanf("%lld%lld", &n, &k);
  for (long long i = 0; i <= n; ++i) scanf("%lld", idx + i), dic[i] = idx[i];
  for (long long i = 1; i <= n + 1; ++i)
    dic[i] += dic[i - 1] / 2, dic[i - 1] %= 2;
  for (long long i = 0; i <= n + 1; ++i) {
    if (dic[i]) {
      ii = i;
      break;
    }
  }
  long long x = 0, ans = 0;
  for (long long i = n + 1; i >= 0; --i) {
    x = x * 2 + dic[i];
    if (abs(x) > INF) break;
    if (i > ii || i == n + 1 || (i == n && x == idx[i])) continue;
    if (abs(x - idx[i]) <= k) ++ans;
  }
  printf("%lld\n", ans);
  return 0;
}
