#include <bits/stdc++.h>
using namespace std;
int n,k,arr[109];
long long dp[109][100009];
long long sum[109][100009];
long long mod = 1000000007;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>arr[i];
	for(int i=0;i<=k;i++) sum[0][i] = 1;
	dp[0][0] = 1;
	for(int i=1;i<=n;i++){
		dp[i][0] = 1;
		sum[i][0] = 1;
		for(int j=1;j<=k;j++){
			dp[i][j] = sum[i-1][j];
			if(j-arr[i]-1 >= 0) dp[i][j] = (dp[i][j] - sum[i-1][j-arr[i]-1] + mod)%mod;
		}
		for(int j=1;j<=k;j++){
			sum[i][j] = (sum[i][j-1] + dp[i][j])%mod;
		}
	}
	cout<<dp[n][k]<<endl;
}
