// Author : Chi
// created : Sunday 2020-05-31
// Sawal : https://www.codechef.com/LTIME84B/problems/TREDIFF

//header files
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//namespaces
using    namespace __gnu_pbds;
using    namespace std;
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

//macros
#define ll 		    long long
#define ss          second
#define ff          first
#define vi          vector<int>
#define vll         vector<long long>
#define pb(x)       push_back(x)
#define TEST  	    int TesT;cin>>TesT;while(TesT--)solve();
#define TEST1       solve();
#define mod         (ll)1e9+7
#define r0n(i,n)    for(ll i = 0; i < n; ++i)
#define r1n(i,n)    for(ll i = 1; i <= n; ++i)
#define pdp(d,i)    fixed<<setprecision(i)<<d
#define CHI         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define db(...)     __f(#__VA_ARGS__, __VA_ARGS__)                      //for debugging
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
//LOVE ALGO
int n;
int *a;
int dp[100001][100];
ll rec(ll t,ll in){
    if(t==0)
        return 1;
    if(in==n)
        return 0;
    if(dp[t][in]!=-1)
        return dp[t][in];
    ll ans=0;
    for(int i=0;i<=a[in];i++){
        if(t-i>=0){
            ll an=rec(t-i,in+1);
            ans+=an;
            ans%=mod;
        }else
        break;
    }
    return dp[t][in]=ans;
}
void solve(){
    int t;
    cin>>n>>t;
    memset(dp,-1,sizeof dp);
    a=new int[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll ans=rec(t,0);
    cout << ans <<"\n";
}

// Driver Code
int main(){
    CHI
    TEST1
    return 0;
}

