#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll n,k;
ll dp[110][100010];
bool mark[110][100010];
ll deca[110];
ll modul=1000000007;

ll resi(ll n, ll k)
{
	if(k<0)
		return 0;
	if(k==0)
		return 1;
	if(n==0)
		return k==0;
	if(mark[n][k])
		return dp[n][k];
	mark[n][k]=true;
	ll tekp=0;
	for(int i=0;i<=deca[n];i++)
		tekp=(tekp+resi(n-1,k-i))%modul;
	dp[n][k]=tekp;
	//cout<<n<<" "<<k<<endl;
	return tekp;
}

int main()
{
	ios::sync_with_stdio(false);	
	cin.tie(0);
	
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>deca[i];
		
	cout<<resi(n,k);
	
	return 0;
}
