#include <bits/stdc++.h>
using namespace std;

#define int long long

const int M = 1e9+7ll;

int n,m,a[105];
int f[105][100005],s[100005];

signed main()
{
	cin>>n>>m;
	for(int i=1;i<=n;cin>>a[i++]);
	f[0][0] = 1;
	for(int i=1;i<=n;i++)
	{
		memset(s,0,sizeof(s));
		s[0] = 1;
		for(int j=1;j<=m;j++)
			s[j] = s[j-1]+f[i-1][j];
		for(int j=0;j<=m;j++)
			if(j>a[i])
				f[i][j] = (s[j]-s[j-a[i]-1])%M;
			else
				f[i][j] = s[j]%M;
	}
	cout<<f[n][m]<<endl;
	
	return 0;
}