#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
int n, w;
int a[105];
ll dp[N], prfx[2][N];
ll pfx(int u, int v, int x)
{
return ((prfx[x][v + 1] % MOD) - (prfx[x][u] % MOD) + MOD) % MOD;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> n >> w;
for (int i = 1; i <= n; i++) cin >> a[i];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= w + 1; i++) prfx[0][i] = 1;
prfx[0][0] = 0; prfx[1][0] = 0; prfx[1][1] = 1;
dp[0] = 1;
for (int i = 1; i <= n ; i++)
{
int y, x; y = i % 2; x = 1 - y;
for (int j = 1; j <= w; j++)
{
dp[j] = pfx(max(0, j - a[i]), j, x);
prfx[y][j + 1] = ((prfx[y][j] % MOD) + dp[j]) % MOD;
}
}
cout << dp[w];
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGxsOwpjb25zdCBpbnQgTU9EID0gMWU5ICsgNzsKY29uc3QgaW50IE4gPSAxZTUgKyA1OwoKCmludCBuLCB3OwppbnQgYVsxMDVdOwpsbCBkcFtOXSwgcHJmeFsyXVtOXTsKCgpsbCBwZngoaW50IHUsIGludCB2LCBpbnQgeCkKewogICAgcmV0dXJuICgocHJmeFt4XVt2ICsgMV0gJSBNT0QpIC0gKHByZnhbeF1bdV0gJSBNT0QpICsgTU9EKSAlIE1PRDsKfQoKCmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7IGNpbi50aWUoTlVMTCk7CgogICAgY2luID4+IG4gPj4gdzsKCiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyBpKyspIGNpbiA+PiBhW2ldOwoKICAgIG1lbXNldChkcCwgMCwgc2l6ZW9mKGRwKSk7CiAgICBmb3IgKGludCBpID0gM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