#include <bits/stdc++.h>
using namespace std;
long long int a[200010];
vector<long long int> cum(200010, 1e9 + 1);
int main() {
  long long int n, k, i, j;
  scanf("%lld", &n);
  ;
  scanf("%lld", &k);
  ;
  for (i = 0; i <= n; i++) scanf("%lld", &a[i]);
  ;
  cum[n + 1] = 0;
  long long int indexx = -1;
  for (i = n; i >= 0; i--) {
    cum[i] = 2 * cum[i + 1] + a[i];
    if (abs(cum[i]) > k) {
      indexx = i - 1;
      break;
    }
  }
  long long int last = 0, ans = 0, flag = 0;
  for (i = 0; i <= indexx; i++) {
    last += a[i];
    if (last % 2 == 1) {
      flag = 1;
      break;
    }
    last /= 2;
  }
  if (flag) {
    cout << "0" << endl;
    return 0;
  }
  for (i = indexx + 1; i <= n; i++) {
    long long int temp = 2 * cum[i + 1] + last;
    if (abs(temp) <= k and temp != -a[i]) {
      if (temp != 0)
        ans++;
      else {
        if (i != n) ans++;
      }
    }
    last += a[i];
    if (last & 1) {
      break;
    }
    last /= 2;
  }
  cout << ans << endl;
  return 0;
}
