#include <bits/stdc++.h>   int n, k, ans;   long long s[200005], a[200005], b[200005];   void neg() {     for (int i = 0; i <= n; i++) {       a[i] = -a[i];       b[i] = -b[i];     }   }   void trans() {     b[n]--;     b[0] += 2;     for (int i = 1; i < n; i++) b[i]++;     for (int i = 0; i < n; i++) {       b[i + 1] += b[i] / 2;       b[i] %= 2;     }   }   void print(long long x[]) {     for (int i = 0; i <= n; i++) printf( %I64d  , x[i]);     printf(  n );   }   int main() {     scanf( %d %d , &n, &k);     for (int i = 0; i <= n; i++) scanf( %I64d , &a[i]);     for (int i = 0; i < n; i++) {       b[i] += a[i];       b[i + 1] += b[i] / 2;       b[i] %= 2;       if (b[i] < 0) {         b[i + 1]--;         b[i] += 2;       }     }     b[n] += a[n];     if (b[n] < 0) neg();     trans();     for (int i = n; i >= 0; i--) {       if (s[i + 1] == 10ll * k + 1)         s[i] = 10ll * k + 1;       else         s[i] = s[i + 1] * 2 + b[i];       if (s[i] > 10ll * k) s[i] = 10ll * k + 1;     }     for (int i = 0; i <= n; i++) {       if (i == n && llabs(s[i] - a[i]) <= k && s[i] != a[i]) ans++;       if (i != n && llabs(s[i] - a[i]) <= k) ans++;       if (b[i]) break;     }     printf( %d n , ans);     scanf(  n );     return 0;   }   