#include <bits/stdc++.h>
using namespace std;
const int N = 200004;
long long a[N], b[N + 5];
int n, l = 0, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  for (int i = 0; i < n; i++) {
    a[i + 1] += a[i] / 2;
    a[i] = a[i] % 2;
  }
  for (int i = 0; i <= n; i++) {
    if (a[i]) {
      l = i;
      break;
    }
  }
  int answ = 0;
  long long sum = 0;
  for (int i = n; i >= 0; i--) {
    sum = sum * 2 + a[i];
    if (abs(sum) > 1e10) break;
    if (i <= l) {
      long long x = abs(sum - b[i]);
      if (x == 0 && i == n) continue;
      if (x <= k) answ++;
    }
  }
  cout << answ << "\n";
  return 0;
}
