#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const long long maxi = 1e17;
long long dw[N], up[N];
int a[N];
bool is[N];
int main() {
  int n, k, i, x, y, u, ret = 0;
  scanf("%d%d", &n, &k);
  ++n;
  for (i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    is[i] = is[i - 1];
    if (!is[i]) {
      if (up[i - 1] % 2 != 0) {
        is[i] = 1;
      } else
        up[i] = up[i - 1] / 2 + a[i];
    }
  }
  long long cur = 0, need;
  for (i = n; i >= 1; --i) {
    cur = cur * 2;
    if (abs(cur) > maxi) break;
    if (!is[i]) {
      need = abs(cur + up[i] - a[i]);
      if (i == n) {
        if (need != 0 && need <= k) ++ret;
      } else if (need <= k)
        ++ret;
    }
    cur += a[i];
  }
  cout << ret << endl;
}
