#include <bits/stdc++.h>
using namespace std;
long long a[2000010] = {0}, b[2000010] = {0};
int main() {
  long long n, tmp, k, sign = 1, mx;
  cin >> n >> k;
  mx = -1;
  for (long long i = 0; i < n + 1; ++i) {
    cin >> b[i];
  }
  for (long long i = 0; i < n + 1000; ++i) {
    a[i] += b[i];
    tmp = abs(a[i]);
    for (long long j = 34; j >= 1; --j) {
      if (tmp >= (1ll << j)) {
        tmp -= (1ll << j);
        if (a[i] > 0) {
          ++a[i + j];
        } else {
          --a[i + j];
        }
      }
    }
    if (a[i] > 0) {
      a[i] = tmp;
    } else {
      a[i] = -tmp;
    }
  }
  long long c = 0;
  for (long long i = 0; i < n + 1000; ++i) {
    if (a[i] != 0) {
      mx = i;
      sign = (a[i] > 0);
    }
  }
  if (sign) {
    for (long long i = 0; i < mx + 2; ++i) {
      if (c) {
        if (a[i] == 1) {
          a[i] = 0;
          c = 0;
        } else if (a[i] == 0) {
          a[i] = 1;
          c = 1;
        } else {
          a[i] = 0;
          c = 1;
        }
      } else {
        if (a[i] == 1) {
          a[i] = 1;
        } else if (a[i] == 0) {
          a[i] = 0;
        } else {
          a[i] = 1;
          c = 1;
        }
      }
    }
  } else {
    for (long long i = 0; i < mx + 2; ++i) {
      if (c) {
        if (a[i] == -1) {
          a[i] = 0;
          c = 0;
        } else if (a[i] == 0) {
          a[i] = 1;
          c = 1;
        } else {
          a[i] = 0;
          c = 1;
        }
      } else {
        if (a[i] == -1) {
          a[i] = 1;
        } else if (a[i] == 0) {
          a[i] = 0;
        } else {
          a[i] = 1;
          c = 1;
        }
      }
    }
  }
  for (long long i = 0; i < n + 1000; ++i) {
    if (a[i] != 0) {
      mx = i;
    }
  }
  long long bound;
  if (mx <= 60) {
    bound = 0;
  } else {
    bound = mx - 60;
  }
  long long sum = 0, cnt = 0;
  for (long long i = mx + 2; i >= 0; --i) {
    if (a[i]) {
      sum += (1ll << (i - bound));
    }
  }
  if (!sign) {
    sum *= -1ll;
  }
  for (long long i = 0; i < n + 1; ++i) {
    if (i > 0) {
      if (a[i - 1] > 0) break;
    }
    if (i >= bound) {
      if (-sum + b[i] <= k && -sum + b[i] >= -k &&
          (-sum + b[i] != 0 || i != n)) {
        ++cnt;
      }
      if (sum % 2) break;
      sum /= 2ll;
    }
  }
  cout << cnt << endl;
}
