#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int MAXN = 1e5 + 10, MD = 1e9 + 7;
int n, k, a[110];
ll dp[110][MAXN];

int main () {
	ios::sync_with_stdio(0), cin.tie(0);
	cout.tie(0);

	cin >> n >> k;
	for (int i = 1; i <= n; ++i) cin >> a[i];

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		ll ans = 0;
		for (int j = 0; j <= k; ++j) {
			ans += dp[i - 1][j];
			if(j - a[i] - 1 >= 0) ans -= dp[i-1][j - a[i] - 1];
			ans = (ans + MD) % MD;
			dp[i][j] = ans;
		}
	}

	cout << dp[n][k] << '\n';

	return 0;
}
