#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
int dp[105][100005];
int a[105],s[100005];
int n,k;
signed main(){
	scanf("%d%d",&n,&k);
	for(int i=0;i< n;i++)scanf("%lld",&a[i]);
	for(int j=0;j<=k;j++)dp[0][j]=0;
	for(int j=0;j<=n;j++)dp[j][0]=1;
	for(int i=1;i<=n;i++){
		s[0]=0;
		for(int j=1;j<=k+1;j++)s[j]=s[j-1]+dp[i-1][j-1];
		for(int j=1;j<=k;j++){
			dp[i][j]=s[j+1]-s[max(0ll,j-a[i-1])];
			dp[i][j] %=MOD;
		}
	}
	printf("%lld\n",dp[n][k]);
	return 0;
}