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

const int M = 1e9+7;
ll n, k, bd[101][200001], a;

int main() {
	cin >> n >> k;
	memset(bd, 0, sizeof(bd));
	bd[0][k] = 1;
	for (int i=1; i<=n; i++) {
		cin >> a;
		bd[i][k] = 1;
		for (int j=k-1; j>=0; j--) {
			bd[i][j] = (bd[i][j+1]-bd[i-1][j+a+1]+bd[i-1][j]+M)%M;	
		}
	}
	cout << bd[n][0] << "\n";
}