#include <bits/stdc++.h>
using namespace std;

int main() {
    int m = 1e9 + 7;
    int n, k, c;
    cin>>n>>k;

    vector<int> dp(k+1, 1);
    while(n--) {
        cin>>c;
        for(int i=k; i>=0; i--)
            dp[i] = (dp[i] + m - (i-c > 0 ? dp[i-c-1] : 0)) % m;
        for(int i=1; i<=k; i++) dp[i] = (dp[i] + dp[i-1]) % m;
    }
    if(k == 0) cout << dp[k] << endl;
    else cout << (dp[k] + m - dp[k-1]) % m << endl;

    return 0;
}