#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ff first
#define ss second
#define int long long int 
#define pb push_back
#define mp make_pair
#define pq priority_queue<int> 
#define pqs priority_queue<int,vector<int>, greater<int>>
#define setbits(x) __builtin_popcountll(x)  // no of ones in setbit
#define zrobits(x) __builtin_ctzll(x)       //101000 here 3..no of 0 aftrer 1sr right one 
#define mod 1000000007
#define inf 1e18
#define prDouble(x)  cout<<fixed<<setprecision(10)<<x     // ans upto 5 decimal place 
#define mk(ar,n,type) type *arr=new type[n];
#define w(x) int x;cin>>x;while(x--)
int dp[110][100010] ;  
#define mod 1000000007


int  fn(int arr[],int k , int n)
{

	for(int i=0 ; i<=k; i++)
	{
		if(i<=arr[1])
		dp[1][i]=1; 
		else
			dp[i][i]=0 ; 
	}

	for(int i=2; i<=n; i++)
	{
		for(int j=0 ; j<=k; j++)
		{
			if(j==0)
			{
				dp[i][j]=dp[i-1][j] ; 
			}
			else
				dp[i][j]=(dp[i][j-1]+dp[i-1][j]- ((j-1-arr[i]>=0)? dp[i-1][j-1-arr[i]] : 0))%mod ; 
		}
	}

	return dp[n][k] ; 

	// 

	
}




int32_t main()
{
	int n, k; 
	cin>>n>>k; 
	int arr[n+1]; 
	for(int i=1 ; i<=n; i++)
	{
		cin>>arr[i] ;  
	}
	// memset(dp, -1, sizeof(dp)) ; 

	int c= fn(arr,k, n); 
	cout<<c; 
}