#include <bits/stdc++.h>
using namespace std;

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define f           first
#define s          second
#define sz(x)       (int)x.size()
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rep0(a,n)  for(int i=0;i<n;i++)cin>>a[i]
#define si(x)       cin>>x
#define sii(x,y)    cin>>x>>y
#define siii(x,y,z) cin>>x>>y>>z
#define ahell   998244353
#define hell 1000000007
#define N1 100001
#define fl 1.0000000000
//#define mod 998244353
#define cntbit(a) __builtin_popcountl(a)
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int dp[101][100001];

void func()
{
    int k,n,i,j,l;
    cin>>n>>k;
    int a[n];

    for(i=0;i<n;i++)
        cin>>a[i];

    for(i=0;i<=a[0];i++)
        {dp[0][i]=i+1;}
    for(i=a[0]+1;i<=k;i++)
    {dp[0][i]+=dp[0][i-1];
     dp[0][i]%=hell;
    }


    for(i=1;i<n;i++)
    {
        for(j=0;j<=k;j++)
        {
            int id1=j,id2=0;
            id2=j-a[i]-1;
            if(id2<0)
                dp[i][j]=dp[i-1][id1];
            else
            {
                dp[i][j]=(dp[i-1][id1]-dp[i-1][id2]+hell)%hell;
            }
        }



        if(i!=(n-1))
        {
            for(j=1;j<=k;j++)
            {dp[i][j]+=dp[i][j-1];dp[i][j]%=hell;
            }
        }
    }


    cout<<dp[n-1][k];
}
main()
{
  ios
int n,m,i;
int j;
int u,v,q;
int test=1;
//si(test);

while(test--)
{
string s;
int d;
func();
}

}
