#include <bits/stdc++.h>
#define ll long long
using namespace std;

const ll int INF = 1e18 + 5;

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int n,k;
    cin>>n>>k;
    ll int a[n];
    for(ll int i=0;i<n;i++){
    	cin>>a[i];
    }
    ll int dp[n][k+1] = {0};
    ll int MOD = 1e9 + 7;
    for(ll int i=0;i<n;i++){
    	for(ll int o = 0;o<=k;o++){
    		// cout<<dp[i][o]<<" "<<i<<" "<<o<<endl;
    		dp[i][o] = 0;
	    	for(ll int j=0;j<=min(o,a[i]);j++){
	    		// cout<<i<<" "<<o<<" "<<j<<endl;
	    		if(i == 0 || o==0)
	    			dp[i][j] = 1;
	    		else 
	    			dp[i][o] = (dp[i][o] + dp[i-1][o-j])%(MOD);
	    	}
	    	// cout<<dp[i][o]<<" "<<i<<" "<<o<<endl;
	    }
    }
    cout<<dp[n-1][k];
	return 0;
}