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

const int MAX_N = 102, MAX_K = 1e5+2, MOD = 1e9+7;
int N, K;
int a[MAX_N];
ll dp[MAX_N][MAX_K];

void solve()
{
	dp[0][0]=1;
	for(int i=0;i<N;++i){
	    ll psum = 0;
		for(int j=0;j<=K;++j){
		    (psum += dp[i][j])%=MOD;
            (dp[i+1][j] += psum)%=MOD;
            if(j>=a[i]) psum = (psum-dp[i][j-a[i]]+MOD)%MOD;
		}
	}
	ll ans = dp[N][K];
	cout << ans << '\n';
}

int main()
{
	cin >> N >> K;
	for(int i=0;i<N;++i) cin >> a[i];
	solve();
	return 0;
}