#include <bits/stdc++.h>
using namespace std;
const int MAXN=110,MAXK=100010;
const long long M=1e9+7;
int n,k,a[MAXN];
long long s[MAXK],dp[MAXN][MAXK];

int main(){
	cin>>n>>k,dp[0][0]=1;
	for(int i=1;i<=n;cin>>a[i],dp[i][0]=1,++i);
	for(int i=1;i<=n;++i){
		for(int j=1;j<=k+1;++j) (s[j]=s[j-1]+dp[i-1][j-1])%=M;
		for(int j=1;j<=k;++j) (dp[i][j]=s[j+1]-s[max(0,j-a[i])]+M)%=M;
	}
	cout<<dp[n][k]<<endl;
	return 0;
}