func_code_string: #include <bits/stdc++.h>   using namespace std;   long long Mul(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = res * a % 1000000007;       a = a * a % 1000000007;       b >>= 1;     }     return res;   }   int A[200005];   long long F[200005], NF[200005], sum[200005], Two[200005];   long long C(int n, int m) {     return F[n] * NF[m] % 1000000007 * NF[n - m] % 1000000007;   }   int main() {     int n;     long long T;     scanf( %d%lld , &n, &T);     for (int i = 1; i <= n; i++) scanf( %d , &A[i]), sum[i] = sum[i - 1] + A[i];     F[0] = 1;     NF[0] = 1;     for (int i = 1; i <= max(n, 2); i++) F[i] = F[i - 1] * i % 1000000007;     for (int i = 1; i <= max(n, 2); i++) NF[i] = Mul(F[i], 1000000007 - 2);     Two[0] = 1;     for (int i = 1; i <= n; i++) Two[i] = Two[i - 1] * NF[2] % 1000000007;     long long ans = 0, res = 1;     int lst = 0;     for (int i = 1; i <= n; i++) {       res = (2ll * res % 1000000007 - C(i - 1, lst)) % 1000000007;       if (i + sum[i] <= T) {         ans++;         ans %= 1000000007;         continue;       }       if (T - sum[i] < 0) break;       long long R = T - sum[i];       for (int j = lst + 1; j <= R; j++) res = (res + C(i, j)) % 1000000007;       for (int j = lst; j >= R + 1; j--) res = (res - C(i, j)) % 1000000007;       lst = R;       ans = (ans + 1ll * res * Two[i] % 1000000007) % 1000000007;     }     printf( %lld n , (ans + 1000000007) % 1000000007);     return 0;   }   