#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[1000100], b[1000100];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  for (int i = 0; i < n; i++) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
  }
  int t = 0;
  for (int i = 0; i <= n; i++) {
    if (a[i] == 0) continue;
    t = i;
    break;
  }
  long long ans = 0;
  int num = 0;
  for (int i = n; i >= 0; i--) {
    ans = ans * 2 + (long long)a[i];
    if (abs(ans) >= 1LL * 1e9 * 1e9) break;
    if (i <= t) {
      if (abs(ans - (long long)b[i]) > k) continue;
      if (i == n && abs(ans - (long long)b[i]) == 0) continue;
      num++;
    }
  }
  cout << num << endl;
  return 0;
}
