#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int,int>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define mod 1000000007
#define int  long long
int pref[101][100005];
int dp[101][100005];
 main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt.txt","r",stdin);
	// freopen("output.txt.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin>>n>>k;
	vi a(n);
	rep(i,0,n) cin>>a[i];

	rep(i,0,n)
	{
		rep(j,0,k+1)
		{
			if(i==0)
			{
				if(j==a[i] or j==0) dp[i][j] = 1;
				else dp[i][j] = 0;
			}
			else
			{
				int id1 = j;
				int id2 = j-a[i]-1;
				dp[i][j] = pref[i-1][id1]%mod;
				if(id2>=0) dp[i][j] -= pref[i-1][id2],dp[i][j] = (dp[i][j]%mod+mod)%mod;
			}
			if(j==0)
			{
				pref[i][j] = dp[i][j]%mod;
			}
			else pref[i][j] = pref[i][j-1]%mod+dp[i][j]%mod,pref[i][j]%=mod;


		}
	}
	cout<<dp[n-1][k]<<endl;




}