#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define vec vector<int,int> 
#define int long long 
#define pii pair<int,int>
int n,arr[101];
int dp[100001][101];
int solve(int i,int k,int sum){
	if(k==0){
	//	cout<<1<<"a"<<endl;
		dp[k][i]=1;
		return 1;
	}
	if(i==n-1 && k<=arr[i]){
	//	cout<<1<<"b"<<endl;
		return 1;
	}
	if(k>sum) {
		dp[k][i]=0;
		return 0;
	}
	if(dp[k][i]!=-1) return dp[k][i]%mod;
	int ans=0;
	//cout<<arr[i]<<endl;
	for(int j=0;j<=arr[i];j++){
		if(k>=j){
			ans+=solve(i+1,k-j,sum-arr[i])%mod;
			ans%=mod;
		}
		else break;
	}
	return (dp[k][i]=ans%mod);
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ios_base& scientific (ios_base& str);
	
	int t=1;
	//cin>>t;
	while(t--){
		int k;
		cin>>n>>k;
		int arr[n];
		rep(i,n) cin>>arr[i];
		int dp[k+1]={0};
		int pre_sum[k+1]={0};
		rep(i,k+1){
			if(i<=arr[0]){
			dp[i]=1;}
			else{
				dp[i]=0;
			}
		}
		pre_sum[0]=dp[0];
		for(int i=1;i<=k;i++){
			pre_sum[i]=pre_sum[i-1]+dp[i];
			pre_sum[i]%=mod;
		}
		REP(i,1,n){
			rep(j,k+1){
				int min_ind=j-arr[i]-1;
				dp[j]=pre_sum[j]%mod;;
				if(min_ind>=0){
					dp[j]-=pre_sum[min_ind];
				}
				dp[j]%=mod;
			}
			pre_sum[0]=dp[0];
			for(int j=1;j<=k;j++){
				pre_sum[j]=(pre_sum[j-1]%mod+dp[j]%mod)%mod;
				pre_sum[j]%=mod;
			}
		}
		cout<<dp[k]%mod<<endl;
	}
	//exit();
	return 0;
}
