#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
long long n, k;
void solve(vector<long long> &v, vector<long long> &a) {
  for (int i = (0); i < (n); ++i) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
    if (a[i] == -1) {
      --a[i + 1];
      a[i] = 1;
    }
  }
  if (a[n] < 0) {
    return;
  }
  long long pos = 0;
  for (int i = (0); i < (n + 1); ++i) {
    if (a[i] != 0) {
      pos = i;
      break;
    }
  }
  long long res = 0;
  long double res2 = 0;
  for (int i = (pos); i < (min(n + 1, pos + 36)); ++i) {
    res += (1LL << (i - pos)) * a[i];
    res2 += (1LL << (i - pos)) * a[i];
  }
  for (int i = (min(n + 1, pos + 35)); i < (n + 1); ++i) {
    if (a[i] != 0) {
      cout << 0 << "\n";
      exit(0);
    }
  }
  if (res2 > 1e11) {
    cout << 0;
    exit(0);
  }
  long long ans = 0;
  long long t = res;
  for (int i = (pos); i > (-1); --i) {
    if (t > 1e12) {
      break;
    }
    if (pos != n || t != v[i]) {
      if (t <= v[i] + k) {
        ++ans;
      }
    }
    t *= 2;
  }
  cout << ans;
  exit(0);
}
int main() {
  cin >> n >> k;
  vector<long long> v(n + 1);
  for (int __i = 0; __i < (n + 1); ++__i) cin >> v[__i];
  ;
  vector<long long> a = v;
  solve(v, a);
  a = v;
  for (int i = (0); i < (n + 1); ++i) {
    v[i] = -v[i];
    a[i] = -a[i];
  }
  solve(v, a);
}
