#include <iostream>

using namespace std;
long long dp[110][100010] = {},mod = 1000000007,a[110];
int main(){
	int i,j,n,k;
	cin >> n >> k;
	dp[0][0] = 1;
	for(i=1;i<=n;i++) cin >> a[i];
	for(i=1;i<=n;i++){
		for(j=0;j<=k;j++){
			(dp[i][j] += dp[i-1][j]) %= mod;
			if(j+a[i]+1<=k) (dp[i][j + a[i] + 1] += mod - dp[i-1][j]) %= mod;
		}
		for(j=1;j<=k;j++){
			(dp[i][j] += dp[i][j-1]) %= mod;
		}
	}
	cout << dp[n][k] << endl;
}