#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#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>

ll dp[101][100001];
ll ma=1e9+7;
ll mod(ll a){
if(a>=0)
    return a;
else return -a;
}


int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
ll a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
dp[0][0]=1;
for(int i=1;i<=k;i++){
    dp[0][i]+=dp[0][i-1];
}
for(int i=1;i<=n;i++){
    for(int j=0;j<=k;j++){
            ll r=j,l=max(1LL*0,j-a[i-1]);
            dp[i][j]+=dp[i-1][r];
            if(l!=0){
                dp[i][j]=(dp[i][j]-dp[i-1][l-1]+ma)%ma;
            }


    }
    for(int j=1;j<=k;j++)
        dp[i][j]=(dp[i][j]+dp[i][j-1])%ma;
}

if(k>0)
    cout<<dp[n][k]-dp[n][k-1]<<endl;
    else cout<<dp[n][k]<<endl;



}
