#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1e5 + 100, MODD = 1e9 + 7;
 
int dp[N], par_sum[N];
 
int main() {
	int n, k, a;
	cin >> n >> k;
	dp[0] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= k; ++j) {
                        par_sum[j + 1] = par_sum[j] + dp[j];
                        par_sum[j + 1] %= MODD;
                }
		cin >> a;
		for (int j = 0; j <= k; ++j) {
			dp[j] = par_sum[j + 1];
			if (j - a >= 1)
				dp[j] -= par_sum[j - a];
			if (dp[j] < 0)
				dp[j] += MODD;
		}
	}
	cout << dp[k] << '\n';
}
