#include <iostream>
using namespace std;
typedef long long ll;
int N,K,A[110];
ll dp[110][100010] = {},inf = 1e9+7;


int main(){
	cin >> N >> K;
	for(int i=1;i<=N;i++){
		cin >> A[i];
	}
	ll ans = 0;
	dp[0][0] = 1;
	for(int i=1;i<=N;i++){
		ll sum[K+10] = {};
		for(int j=0;j<=K;j++){
			sum[j] += dp[i-1][j];
			if(j>0) sum[j] += sum[j-1];
			sum[j] %= inf;
		}
		for(int j=0;j<=K;j++){
			if(j-A[i]-1<0) dp[i][j] += sum[j];
			else dp[i][j] += sum[j]-sum[j-A[i]-1];
			dp[i][j] %= inf;
		}
	}
	cout << dp[N][K] << endl;
}