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

#define REP(i,n) for(int (i)=0; i<(int)(n); i++)

int dp[101][100100];

int main(void) {
	int N,K;
	cin >> N >> K;
	dp[0][0] = 1;
	REP(i,N) {
		int x;
		cin >> x;
		int sum=0;
		for(int j=0; j<=K; j++) {
			sum = (sum+dp[i][j]) % 1000000007;
			if(j > x)
				sum = (sum+1000000007-dp[i][j-x-1]) % 1000000007;
			dp[i+1][j] = sum;
		}
	}
	cout << dp[N][K] << endl;
	return 0;
}
