#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;
int n, a[110], k;
long long dp[110][100100];

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> a[i];
	
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= k; j++) {
			dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
		}
		for (int j = 0; j <= k; j++) {
			dp[i + 1][j] = dp[i][j];
			if (j - a[i] - 1 >= 0) dp[i + 1][j] += mod - dp[i][j - a[i] - 1];
			dp[i + 1][j] %= mod;
		}
	}
	
	cout << dp[n][k] << '\n';
}
