#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
ll dp[101][100001];
ll dp2[101][100001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
    	cin>>n>>k;
    	ll ar[n];
    	for(int i=0;i<n;i++)
    	{
    		cin>>ar[i];
    		dp[i+1][0] = 1;
    		dp2[i+1][0] = 1;
    	}
    	dp[0][0] = 1;
    	dp2[0][0] = 1;
		for(int j=1;j<=k;j++)
    	{
    		dp2[0][j]=1;
    		for(int i=1;i<=n;i++)
    		{
    			ll val = ar[i-1];
    			if(val>=j)
    			{
    				dp[i][j] = (dp2[i-1][j]);
    			}
    			else
    			{
    				dp[i][j] = (dp2[i-1][j] - dp2[i-1][j-val-1]); 
    			}
    			// dp[i][j]+=;
    			dp2[i][j] += (dp2[i][j-1] + dp[i][j])%mod;
    			dp2[i][j] %= mod;
    			// cout<<i<<" "<<j<<" "<<dp[i][j]<<" "<<dp2[i][j]<<endl;
    		}
    	}
    	cout<<dp[n][k]<<endl;
    }
    return 0;
}