#include<bits/stdc++.h>
using namespace std;
typedef int ll;
//typedef unsigned long long ull;

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
ll MOD = 1e9+7;

ll dp[104][100009];
ll a[104],pre[104][100009];
inline int add(int a, int b){
    a += b;
    if(a >= MOD)a -= MOD;
    return a;
}
 
inline int sub(int a, int b){
    a -= b;
    if(a < 0)a += MOD;
    return a;
}
int main(){
    fast;
    ll n,k;cin>>n>>k;

    for(ll i=0;i<n;++i){
        cin>>a[i];
    }

    for(ll i=0;i<n;++i)
        pre[i][0] = dp[i][0] = 1;
    
    
    for(ll i=0;i<=k;++i){
        dp[0][i] = 1*(i<=a[0]);
        if(i>0)
            pre[0][i] = pre[0][i-1] + dp[0][i];
        else
            pre[0][0] = 1;
        
    }
    for(ll i=1;i<n;++i){
        for(ll j=1;j<=k;++j){//sum to make
            if(j-a[i]-1<0){
                dp[i][j] = pre[i-1][j]%MOD;
            }
            else{
                dp[i][j] = sub(pre[i-1][j] , pre[i-1][j-a[i]-1]);
            }
            pre[i][j] = add(pre[i][j-1]%MOD + dp[i][j]);

            
            /*int first = (j - a[i] - 1 >= 0)? pre[i - 1][j - a[i] - 1] : 0;
            int last = pre[i - 1][j];
            dp[i][j] = add(dp[i][j], sub(last, first));
            pre[i][j] = add(pre[i][j - 1], dp[i][j]);
            */
            /*  precalculate the sum from dp[i-1][max(0,j-a[i])] to dp[i-1][j].
                which is equal to dp[i-1][j] - dp[i-1][max(0,j-a[i])-1]
            */
            /*for(ll l=max(0ll,j-a[i]);l<=j;++l){//
                dp[i][j] = (dp[i][j]%mod + dp[i-1][l]%mod)%mod;
                
            }*/
        }
    }
    /*cout<<endl<<"prefix\n";
    for(ll x=0;x<n;++x){ 
        cout<<"\n->"<<x+1<<endl; 
        for(ll i=0;i<=k;++i){
            cout<<"\t"<<pre[x][i]<<" ";
        }
    }
    cout<<"\ndp\n";
    for(ll x=0;x<n;++x){
        cout<<"\n->"<<x+1<<endl;
        for(ll i=0;i<=k;++i){
            cout<<"\t"<<dp[x][i]<<" ";
        }
    }*/

    cout<<dp[n-1][k];

    return 0;
}