#include <iostream>

using namespace std;

typedef long long ll;

ll dp[105][100005];
ll mod = 1e9 + 7;

int main(int argc, char *argv[])
{
	int N, K, a[100005];

	cin >> N >> K;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i <= N; i++) {
		dp[i][0] = 1;
	}
	for (int i = 1; i <= N; i++) {
		for (int j =1; j <= K; j++) {
			dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
			if (j - a[i - 1] - 1 >= 0) {
				dp[i][j] = (dp[i][j] + mod - dp[i - 1][j - a[i - 1] - 1]) % mod;
			}
		}
	}

	cout << dp[N][K] << endl;

	return 0;
}