#include "bits/stdc++.h"

using namespace std;

const int MOD = 1e9+7;

void solve()
{
	int N, K, a;
	cin >> N >> K;
	vector<long> dp(K+1);
	dp[0] = 1;
	for (int i = 0; i < N; i++)
	{
		cin >> a;
		vector<long> nx = dp;
		for (int j = 1; j <= K; j++)
		{
			if (j > a)
			{
				(nx[j] += nx[j-1] - dp[j-a-1] + MOD) %= MOD;
			}
			else
			{
				(nx[j] += nx[j-1]) %= MOD;
			}
		}
		dp = nx;
	}

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

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}
