#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int , int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti set <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
ll dp[100][100001]
int main()
{  
    FAST
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<=k;j++)
        {
            dp[i][j]=0;
        }
    }
    for(ll i=0;i<=a[0];i++)
    {
        dp[0][i]=1;
    }
    for(ll i=1;i<n;i++)
    {
        ll q=0;
        for(ll j=0;j<=k;j++)
        {
            q+=dp[i-1][j];
            if(j>a[i])
                q-=dp[i-1][j-a[i]];
          q%=mod;
          q+=mod;
          q%=mod;
            dp[i][j]=q;
        }
    }
    cout<<dp[n-1][k];
}