#include<cstdio>
#define N 100005
#define mod 1000000007
int n,k,a[105],dp[105][N],sum[N];
int main(){
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;++i)scanf("%d",&a[i]);
	sum[0]=1;
	for(int i=1;i<=k;++i)sum[i]=1;
	for(int i=0;i<n;++i){
		for(int j=0;j<=k;++j)dp[i][j]=(sum[j]+mod-(j-a[i]-1<0?0:sum[j-a[i]-1]))%mod;
		sum[0]=dp[i][0];
		for(int j=1;j<=k;++j)sum[j]=(sum[j-1]+dp[i][j])%mod;
	}
	printf("%d\n",dp[n-1][k]);
	return 0;
}