#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define print(n) cout<<n<<endl
const int mod=1000000007;

int main(){
	int n,k,a[M];
	ll dp[101][M]={},sum[M]={};
	cin>>n>>k;
	rep(i,0,n)cin>>a[i];
	dp[0][0]=1;
	rep(i,1,n+1){
		rep(j,1,k+1)sum[j]=(sum[j-1]+dp[i-1][j-1])%mod;
		//sum[j]=dp[i-1][j-1] + ... + dp[i-1][0];
		rep(j,0,k+1){
			dp[i][j]=(sum[j]-sum[max(0,j-a[i-1])]+dp[i-1][j])%mod;
		}
	}
	print(dp[n][k]);
}