Limak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.

He considers a polynomial valid if its degree is n and its coefficients are integers not exceeding k by the absolute value. More formally:

Let a0, a1, ..., an denote the coefficients, so <image>. Then, a polynomial P(x) is valid if all the following conditions are satisfied:

  * ai is integer for every i; 
  * |ai| ≤ k for every i; 
  * an ≠ 0. 



Limak has recently got a valid polynomial P with coefficients a0, a1, a2, ..., an. He noticed that P(2) ≠ 0 and he wants to change it. He is going to change one coefficient to get a valid polynomial Q of degree n that Q(2) = 0. Count the number of ways to do so. You should count two ways as a distinct if coefficients of target polynoms differ.

Input

The first line contains two integers n and k (1 ≤ n ≤ 200 000, 1 ≤ k ≤ 109) — the degree of the polynomial and the limit for absolute values of coefficients.

The second line contains n + 1 integers a0, a1, ..., an (|ai| ≤ k, an ≠ 0) — describing a valid polynomial <image>. It's guaranteed that P(2) ≠ 0.

Output

Print the number of ways to change one coefficient to get a valid polynomial Q that Q(2) = 0.

Examples

Input

3 1000000000
10 -9 -3 5


Output

3


Input

3 12
10 -9 -3 5


Output

2


Input

2 20
14 -7 19


Output

0

Note

In the first sample, we are given a polynomial P(x) = 10 - 9x - 3x2 + 5x3.

Limak can change one coefficient in three ways:

  1. He can set a0 = - 10. Then he would get Q(x) = - 10 - 9x - 3x2 + 5x3 and indeed Q(2) = - 10 - 18 - 12 + 40 = 0. 
  2. Or he can set a2 = - 8. Then Q(x) = 10 - 9x - 8x2 + 5x3 and indeed Q(2) = 10 - 18 - 32 + 40 = 0. 
  3. Or he can set a1 = - 19. Then Q(x) = 10 - 19x - 3x2 + 5x3 and indeed Q(2) = 10 - 38 - 12 + 40 = 0. 



In the second sample, we are given the same polynomial. This time though, k is equal to 12 instead of 109. Two first of ways listed above are still valid but in the third way we would get |a1| > k what is not allowed. Thus, the answer is 2 this time.
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int maxN = 210000;
const int maxD = 10;
int n, k;
int a[maxN];
long long p[maxD];
long long p2[maxD][maxN];
long long x[maxD][maxN], y[maxD][maxN];
long long v[maxD][maxN];
long long w[maxD];
bool isPrime(long long n) {
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
long long inv(long long a, long long p) {
  long long x1 = 1, b1 = a;
  long long x2 = 0, b2 = p;
  while (b2) {
    long long q = b1 / b2;
    b1 -= q * b2;
    x1 -= q * x2;
    swap(b1, b2);
    swap(x1, x2);
  }
  x1 %= p;
  if (x1 < 0) {
    x1 += p;
  }
  return x1;
}
int main() {
  scanf("%d%d", &n, &k);
  ++n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int m = 0;
  for (long long i = 2000000000 + (rand() % 100000); m < maxD; ++i) {
    if (isPrime(i)) {
      p[m++] = i;
    }
  }
  for (int i = 0; i < maxD; ++i) {
    p2[i][0] = 1LL % p[i];
    for (int j = 1; j < maxN; ++j) {
      p2[i][j] = (2LL * p2[i][j - 1]) % p[i];
    }
  }
  for (int i = 0; i < maxD; ++i) {
    for (int j = 0; j < n; ++j) {
      v[i][j] = ((long long)(a[j]) * p2[i][j]) % p[i];
    }
    for (int j = 0; j < n; ++j) {
      x[i][j] = v[i][j];
      if (j > 0) {
        x[i][j] += x[i][j - 1];
        x[i][j] %= p[i];
      }
    }
    for (int j = n - 1; j >= 0; --j) {
      y[i][j] = v[i][j];
      if (j + 1 < n) {
        y[i][j] += y[i][j + 1];
        y[i][j] %= p[i];
      }
    }
  }
  long long ways = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < maxD; ++j) {
      w[j] = (i > 0 ? x[j][i - 1] : 0) + (i + 1 < n ? y[j][i + 1] : 0);
      w[j] %= p[j];
    }
    long long value = (-w[0] * inv(p2[0][i], p[0])) % p[0];
    value = ((value % p[0]) + p[0]) % p[0];
    if (value > (long long)(k)) {
      value -= p[0];
    }
    if (i + 1 == n && value == 0) {
      continue;
    }
    if (value >= (long long)(-k) && value <= (long long)(k)) {
      bool isOk = true;
      for (int j = 0; j < maxD; ++j) {
        long long r = (w[j] + (p2[j][i] * value)) % p[j];
        if (r != 0) {
          isOk = false;
          break;
        }
      }
      if (isOk) {
        ++ways;
      }
    }
  }
  cout << ways << endl;
  return 0;
}
