#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define For(i,n) for(int i=0;i<n;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define MAXN 100001
int arr[MAXN];
int dp[101][100001];
int n, m;
int fun(int I, int sum)
{
	if (sum == m) return 1;
	if (sum > m)return 0;
	if (I > n)return 0;
	int ret = 0;
	if (dp[I][sum] != -1)return dp[I][sum];
	for (int i = 0; i <= arr[I]; i++)
	{
		ret = (ret % mod + fun(I + 1, sum + i) % mod) % mod;
	}
	dp[I][sum] = ret;
	return ret;
}


int32_t main()
{


	cin >> n >> m;
	mem(dp, 0);
	for (int i = 1; i <= n; i++)cin >> arr[i];
	int remain = n;
	int ret = 0;
	int sum = 0;
	int rr = arr[0];

	// for (int j = 0; j <= rr; j++)
	// {
	// 	ret = (ret % mod + fun( 1 , sum + j) % mod) % mod;

	// }
	for (int i = 0; i <= min(arr[1], m); i++)
	{
		dp[1][i] = 1;
	}
	for (int i = 1; i <= n; i++)
	{

		for (int j = 0; j <= m; j++)
		{
			for (int k = 0; k <= arr[i]; k++)
			{
				dp[i][j] = (dp[i][j] % mod + dp[i - 1][j - k]) % mod;
			}
		}
	}
	cout << dp[n][m];
}