#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 20;
int n;
long long k;
long long a[maxn], b[maxn];
long long ABS(long long x) { return x < 0 ? -x : x; }
int main() {
  cin >> n >> k;
  for (int i = 0; i < n + 1; i++) {
    scanf("%I64d", &a[i]);
    b[i] = a[i];
  }
  for (int i = 0; i < n; i++) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
  }
  int st = 0;
  for (int i = 0; i < n + 1; i++) {
    if (a[i]) {
      st = i;
      break;
    }
  }
  long long sum = 0;
  int ans = 0;
  for (int i = n; i >= 0; i--) {
    sum = (sum << 1) + a[i];
    long long dif = ABS((sum - b[i]));
    if (dif > 1e10) break;
    if (i > st || dif > k) continue;
    if (i == n && dif == 0) continue;
    ans++;
  }
  cout << ans << endl;
  return 0;
}
