#include <bits/stdc++.h>
#define int long long
#define mod ( (int)1e9 + 7 )
using namespace std;
int a , dp[10000007];
 
void solve()
{
	int n , k;
	cin >> n >> k;
	
	dp[0] = 1;
	
	for(int i = 1; i <= n; i++)
	{
		cin >> a;
		for(int j = 1; j <= k; j++)dp[j] = (dp[j - 1] % mod + dp[j] % mod ) % mod;
		for(int j = k; j >= a + 1; j--)dp[j] = ( dp[j] % mod - dp[ j - a - 1 ] % mod ) % mod;
		
	}
	
	cout << dp[k] << endl;
}
 
 
main()
{
	solve();
}
