#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
#define rep1(i, a, b) for(int i=a; i<=(int)(b); i++)
typedef long long LL;

const int MAX_N = 101, MAX_K=1e7+1, mod = 1e9+7;
int n, K, A[MAX_N], dp[MAX_N][MAX_K];

int main() {
    scanf("%d %d", &n, &K);
    rep(i, n) scanf("%d", &A[i]);
    rep(i, n+1) dp[i][0]=1;
    rep1(i, 1, n) {
        rep1(j, 1, K) {
            dp[i][j] = (dp[i][j-1]+dp[i-1][j]) % mod;
            if(j-1-A[i-1]>=0) dp[i][j] = (dp[i][j]-dp[i-1][j-1-A[i-1]]+mod)%mod;
        }
    }
    // rep(i,n+1) rep(j,K+1) {
    //     printf("%d%c", dp[i][j], ((j==K)?'\n':' '));
    // }


    printf("%d\n", dp[n][K]);
    return 0;
}
