#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define TT pair<long long, long long>
#define ordered_set tree<TT, null_type, less<TT>, rb_tree_tag, tree_order_statistics_node_update>
#define fo(i,n)   for(i=0;i<n;i++)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define mp make_pair
#define For(m) for(auto it = m.begin();it!=m.end();it++)
#define fi first
#define se second
typedef long long ll;
typedef long double mytype;
ll n,k,a[200005],dp[100][200005],mod=1e9 + 7;
ll solve(ll curr,ll c){
    if(curr==n){
        if(c==k)
        return 1;
        return 0;
    }
    if(c>k)
    return 0;
    if(dp[curr][c]!=-1)
    return dp[curr][c];
    ll ans=0,i,t;
    fo(i,a[curr] + 1){
        t=solve(curr+1,c+i);
        ans+=t;
        ans%=mod;
    }
    ans%=mod;
    return dp[curr][c]=ans;
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //priority_queue <int, vector<int>, greater<int> > pq;
    //cout << fixed << setprecision(9) <<ans<<endl;
    //ordered_set os;//os.order_of_key();//os.find_by_order();
    ll l,r,count,m,sum=0,ans=0,i,j,tt,t,x,y,z,c,b[200005]={};
    string ss;
    set<ll> s;
    vector<ll> v;
    map<ll,ll> ma;
    cin>>n>>k;
    fo(i,n)
    cin>>a[i];
    mem(dp,-1);
    cout<<solve(0,0);
}