#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

const int N = 100;
const int K = 1e5;
ll dp[N+1][K+1];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, k;
	cin >> n >> k;

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

		ll run = 0;
		for (int x = 0; x <= k; ++x) {
			run += dp[i][x];
			if (x > a) run -= dp[i][x-a-1];

			dp[i+1][x] = run % MOD;
		}
	}

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