#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ass 1e18
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x,y) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<< endl;
#define debug3(x,y,z) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<<" "<<#z<<" : "<<z<< endl;
using namespace std;
typedef long long int ll;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll arr[105],dp[105][100005],n,k;

int main()
{
	ll i,j;
	boost
	cin>>n>>k;
	for(i=1;i<=n;i++)
		cin>>arr[i];
	dp[1][0]=1;
	if(n==1)
	{
		if(k<arr[1])
			cout<<1;
		else
			cout<<0;
		return 0;
	}
	for(i=1;i<=arr[1];i++)
		dp[1][i]=dp[1][i-1]+1;
	for(i=arr[1]+1;i<=k;i++)
		dp[1][i]=dp[1][i-1];
	for(i=2;i<=n;i++)
	{
		for(j=0;j<=k;j++)
		{
			if(j-arr[i]>0)
				dp[i][j]=(dp[i-1][j]-dp[i-1][j-arr[i]-1]+MOD)%MOD;
			else
				dp[i][j]=dp[i-1][j];
		}
		if(i!=n)
		{
			for(j=1;j<=k;j++)
				dp[i][j]=(dp[i][j]+dp[i][j-1])%MOD;
		}
	}	
	cout<<dp[n][k];
	return 0;
}