#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set =
tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll memo[101][100001];
int n,k,arr[101];
const int mod=1e9+7;
ll solve(int idx=0,int sum=k){
    if(idx<=n && !sum)
        return 1;
    if(idx==n || sum<=0)
        return 0;
    ll &cur=memo[idx][sum];
    if(~cur)
        return cur;
    cur=0;
    cur+=solve(idx+1,sum)%mod;
    cur+=solve(idx,sum-1)%mod;
    cur-=solve(idx+1,sum-arr[idx]-1)%mod;
    return cur%mod;
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    memset(memo,-1, sizeof(memo));
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    cout<<solve()%mod;
}