#include <bits/stdc++.h>
using namespace std;

const int mxN=100, mxK=1e5, M=1e9+7;
int n, a[mxN], k;
long long dp[mxN+1][mxK+1];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> k;
	for(int i=0; i<n; ++i)
		cin >> a[i];
	dp[0][0]=1;
	for(int i=0; i<n; ++i) {
		for(int j=1; j<=k; ++j)
			dp[i][j]=(dp[i][j]+dp[i][j-1])%M;
		for(int j=0; j<=k; ++j) {
			dp[i+1][j]=dp[i][j];
			if(j-a[i]-1>=0)
				dp[i+1][j]+=M-dp[i][j-a[i]-1];
			dp[i+1][j]%=M;
		}
	}
	cout << dp[n][k];
}