#include <cstdio>
#include <cstring>
int S[100001],dp[101][100001],n,k,a[100001],c;const int p=1e9+7;
int &s(int x){if(x<0)return c;else return S[x];}
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)s(i)=1;
	for(int i=1;i<=n;++i)
	{
		for(int j=0;j<=k;++j)dp[i][j]=((s(j)-s(j-a[i]-1))%p+p)%p;
		for(int j=0;j<=k;++j)s(j)=(s(j-1)+dp[i][j])%p;
	}
	printf("%d\n",dp[n][k]);
}