#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;

ll dfs(ll x,ll s)
{
	if(x>n||s>k)
		return 0;
	if(dp[x][s]!=-1)
		return dp[x][s];
	if(x==n)
	{
		for(ll i=0;i<=arr[n];i++)
		{
			if(s+i==k)
			{
				dp[n][s]=1;
				return 1;
			}
		}
		dp[n][s]=0;
		return 0;
	}
	ll sum=0,i;
	for(i=0;i<=arr[x];i++)
		sum=(sum+dfs(x+1,s+i))%MOD;
	dp[x][s]=sum%MOD;
	return sum;
}

int main()
{
	ll i;
	boost
	cin>>n>>k;
	memset(dp,-1,sizeof(dp));
	for(i=1;i<=n;i++)
		cin>>arr[i];
	dfs(1,0);	
	cout<<dp[1][0];
	return 0;
}