#include<bits/stdc++.h>

using namespace std;
const int maxn=100005;
const int mod=1e9+7;

int n,k,a[maxn],dp[105][maxn];

int main()
{
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	for(int i=0;i<=n;i++) dp[i][0]=1;
	for(int i=0;i<n;i++){
		for(int j=1;j<=k;j++){
			if(j-1-a[i]>=0) dp[i+1][j]=((dp[i+1][j-1]+dp[i][j]-dp[i][j-1-a[i]])%mod+mod)%mod;
			else dp[i+1][j]=(dp[i+1][j-1]+dp[i][j])%mod;
		}
	}
	printf("%d\n",dp[n][k]);
}