#include <bits/stdc++.h>
const int N=100005,mu=1000000007;
int n,k,a[N],dp[N],s[N],sum;
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	dp[0]=s[0]=1;
	for (int i=1;i<=a[1];i++) s[i]=1;
	sum=a[1];
	for (int i=1;i<=n;i++){
		for (int j=0;j<=sum;j++) 
			if (j-a[i]>0) dp[j]=s[j]-s[j-a[i]-1];
			else dp[j]=s[j];
		s[0]=dp[0];
		sum+=a[i+1];
		sum=std::min(sum,k);
		for (int j=1;j<=sum;j++) s[j]=((s[j-1]+dp[j])%mu+mu)%mu;
	}
	printf("%d\n",(dp[k]+mu)%mu);
}