#include <bits/stdc++.h>
using namespace std;
long long cof[200004];
long long pref[200004];
long long suf[200004];
bool okpref[200004];
bool oksuf[200004];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(30);
  int n;
  long long k;
  int ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n + 1; i++) {
    cin >> cof[i];
  }
  long long d = 0;
  bool curstate = 0;
  for (int j = n; j >= 0; j--) {
    d += cof[j] * (!curstate) - cof[j] * (curstate);
    if (d < 0) {
      d = -d;
      curstate ^= 1;
    }
    d = d << 1LL;
    if (d > 4000000000LL) {
      break;
    }
    suf[j] = d * (!curstate) - d * curstate;
    oksuf[j] = 1;
  }
  long long dd = 0;
  curstate = 0;
  for (int j = 0; j < n + 1; j++) {
    dd += cof[j] * (!curstate) - cof[j] * curstate;
    if (dd < 0) {
      dd = -dd;
      curstate ^= 1;
    }
    if ((dd & 1)) {
      break;
    }
    dd = dd >> 1LL;
    pref[j] = dd * (!curstate) - dd * curstate;
    okpref[j] = 1;
  }
  for (int i = 0; i < n + 1; i++) {
    long long aux = 0;
    if (i) {
      if (!okpref[i - 1]) continue;
      aux += pref[i - 1];
    }
    if (i < n) {
      if (!oksuf[i + 1]) continue;
      aux += suf[i + 1];
    }
    if (abs(aux) <= k and !(i == n and aux == 0)) {
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}
