#include<iostream>
using namespace std;
#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007



ll dp[101][100001] = {};
int a[101];
ll sum[100001];
int n,k;

ll rec(int idx , int left){
	if(idx<1 && left!=0) return 0;
	if(idx<1 && left==0) return 1;
	ll& ans = dp[idx][left];
	if(ans!=-1) return ans%mod;
	
	ans=0;
	for(int i=0;i<=a[idx] ; ++i){
		if(left-i>=0) ans += rec(idx-1 , left-i);
		ans%=mod;
	}
	return ans%mod; 
}

int main(){
	//memset(dp,1,sizeof(dp));
	IOS;
	cin >> n >> k;
	for(int i=1;i<=n ;++i){
		cin >> a[i];
	}

	for(int i=0;i<=a[1] ; ++i){
		dp[1][i] = 1;
	}
	
	for(int i=2; i <=n ; ++i){
		sum[0] = dp[i-1][0];
		for(int c=1;c<=k ; ++c){
			sum[c] = (sum[c-1] + dp[i-1][c] + mod) % mod;
		}
		for(int j = 0;j<=k ; ++j){
			if(j-min(j,a[i])-1<0)dp[i][j] = sum[j];
			else cadp[i][j] = sum[j] - sum[j-min(j,a[i])-1];
		}
	}
	cout << (dp[n][k] + mod)%mod << endl;
}