#include <bits/stdc++.h>
using namespace std;
int nxt() {
  int first;
  scanf("%d", &first);
  return first;
}
struct pt {
  long long first, second;
  pt() {}
  pt(long long first, long long second) : first(first), second(second) {}
  pt operator-(const pt &r) const {
    return pt(first - r.first, second - r.second);
  }
  bool operator<(const pt &r) const {
    if (first != r.first) return first < r.first;
    return second < r.second;
  }
  bool operator==(const pt &r) const {
    return first == r.first && second == r.second;
  }
};
long long cross(const pt &l, const pt &r) {
  return l.first * r.second - l.second * r.first;
}
long long dot(const pt &l, const pt &r) {
  return l.first * r.first + l.second * r.second;
}
long long pwmod(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long inv(long long a, long long mod) { return pwmod(a, mod - 2, mod); }
const int N = 300 * 1000 + 10;
int a[N];
long long s[N];
void solve() {
  int n = nxt();
  int k = nxt();
  for (int i = 0; i < (int)(n + 1); i++) a[i] = nxt();
  for (int i = 0; i <= n; ++i) {
    s[i] = a[i];
  }
  int i;
  for (i = 0; i <= n || (s[i] != 0 && s[i] != -1); ++i) {
    if (s[i] & 1) {
      s[i] -= 1;
      s[i + 1] += s[i] / 2;
      s[i] = 1;
    } else {
      s[i + 1] += s[i] / 2;
      s[i] = 0;
    }
  }
  if (s[i] != 0) ++i;
  int sz = i;
  while (sz > 1 && s[sz - 1] == 0) {
    --sz;
  }
  if (s[sz - 1] == -1) {
    for (i = 0; i < sz; ++i) {
      s[i] *= -1;
    }
    for (i = 0; i < sz; ++i) {
      a[i] *= -1;
    }
    for (i = 0; i < sz || (s[i] != 0); ++i) {
      if (s[i] & 1) {
        s[i] -= 1;
        s[i + 1] += s[i] / 2;
        s[i] = 1;
      } else {
        s[i + 1] += s[i] / 2;
        s[i] = 0;
      }
    }
    sz = i;
    while (sz > 1 && s[sz - 1] == 0) {
      --sz;
    }
  }
  long long ans = 0;
  bool ok = true;
  for (i = 0; i <= n && i < sz && ok; ++i) {
    long long cc = 0;
    int j;
    for (j = 0; i + j < sz && j < 35; ++j) {
      cc += s[i + j] * (1ll << j);
    }
    if (i + j == sz) {
      if (i < n) {
        if (abs(-cc + a[i]) <= k) {
          ++ans;
        }
      } else {
        if (abs(-cc + a[i]) <= k && abs(-cc + a[i]) != 0) {
          ++ans;
        }
      }
    }
    if (s[i] != 0) {
      ok = false;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int i = 0; i < (int)(t); i++) {
    solve();
  }
  cerr << "Time " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
