#include"bits/stdc++.h"
using namespace std;
#define LL long long

int N,K,a[100];
LL dp[101][100001] = {};
LL wa[101][100002] = {};
const LL MOD = 1000000007;

int main(){
	cin >> N >> K;
	for(int i=0; i<N; i++) cin >> a[i];

	dp[0][0] = 1;
	for(int i=0; i<=K; i++) wa[0][i+1] = 1;
	for(int i=1; i<=N; i++){
		for(int j=0; j<=K; j++){
			dp[i][j] = wa[i-1][j+1] - wa[i-1][max(0,j-a[i-1])] + MOD;
			dp[i][j] %= MOD;
			wa[i][j+1] = wa[i][j] + dp[i][j];
			wa[i][j+1] %= MOD;
		}
	}
	cout << dp[N][K] << endl;

	return 0;
}