#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "
#define F           first
#define S           second
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353 ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
// mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());  after namespace std
// srand(chrono::high_resolution_clock::now().time_since_epoch().count()); after ios:base
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll n,k;
ll a[102];
ll dp[102][100005];
ll prefsum[102][100005];
/*ll f(ll i,ll done)
{
    if(i==n)
    {
        if(done==k)
            return 1;
        else
            return 0;
    }
    if(done>k)
        return 0;
    if(dp[i][done]!=-1)
        return dp[i][done];
    ll j;
    ll ans=0;
    for(j=0;j<=a[i];j++)
        ans=(ans+f(i+1,done+j))%hell;
    dp[i][done]=ans;
    return ans;
}*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    memset(dp,0,sizeof(dp));
    memset(prefsum,0,sizeof(prefsum));
    ll i,j;
    cin>>n>>k;
    for(i=0;i<n;i++)
        cin>>a[i];
    //cout<<f(0,0);
    for(i=0;i<100005;i++)
    {
        if(i<=a[0])
            dp[0][i]=1;
        else
            dp[0][i]=0;
    }
    prefsum[0][0]=dp[0][0];
    for(i=1;i<100005;i++)
        prefsum[0][i]=prefsum[0][i-1]+dp[0][i];
    for(i=1;i<n;i++)
    {   ll p=dp[i-1][0];
        prefsum[i-1][0]=p;
        for(j=1;j<=k;j++)
            {
                p=(p+dp[i-1][j])%hell;
                prefsum[i-1][j]=p;
            }
        for(j=0;j<=k;j++)
        {
            if(j>=(a[i-1]+1))
                dp[i][j]=(prefsum[i-1][j]-prefsum[i-1][j-a[i-1]-1]+hell)%hell;
            else
                dp[i][j]=(prefsum[i-1][j]+hell)%hell;
        }
    }
    cout<<dp[n-1][k];
    return 0;
}
