#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n,k;
int a[200];
int f[200][100005];
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=0;i<=k;i++)f[0][i]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=k;j++){
			if(j<a[i]+1)f[i][j]=f[i-1][j]%mod;
			else f[i][j]=(f[i-1][j]-f[i-1][j-a[i]-1]+mod)%mod;
		}
//		for(int j=0;j<=k;j++)printf("%d ",f[i][j]);puts("");
		for(int j=1;j<=k;j++)f[i][j]=(f[i][j]+f[i][j-1])%mod;
	}
	printf("%d\n",(f[n][k]-f[n][k-1]+mod)%mod);
	return 0;
}