#include<iostream>
using namespace std;
int n,k,a,i;
long dp[111][2<<17],mod=1e9+7;
int main()
{
	cin>>n>>k;
	dp[0][k]=1;
	for(;cin>>a;i++)
	{
		for(int j=k;j>=0;j--)
		{
			(dp[i+1][j]=dp[i][j]+dp[i+1][j+1]-dp[i][j+a+1]+mod)%=mod;
		}
	}
	cout<<dp[i][0]<<endl;
}