#include <bits/stdc++.h>

using namespace std;

long d[111111] = { 1 };
int main() {
	int n, k, p = 1e9 + 7;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		partial_sum(d, d + k + 1, d);
		for (int j = k - a; j--;)
			d[j + a + 1] -= d[j];
		for (int j = 0; j < k; j++)
			d[j + 1] %= p;
	}
	cout << d[k] << endl;
	return 0;
}
