#include <bits/stdc++.h>

using namespace std;
#define int long long int
#define vi vector<int>
#define pi pair<int,int>
#define ff first
#define ss second
//#define vlli vector<long long int>
#define si set<int>
#define loop(i,k,n) for(int i=k;i<n;i++)
#define MOD 1000000007
#define r0 return 0
/*
//gcd in O(log(an n n nnnnn n n
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
*/
/*
int gcd, x, y;

void extendedEuclid (int a, int b)
{
    if (b==0)
    {
        x=1;
        y=0;
        gcd=a;
        return;
    }
    extendedEuclid(b, a%b);
    int x1=y;
    int y1=x-(a/b)*y;
    x=x1;
    y=y1;
}

int nCr (int n, int r)
{
    int p=1, k=1, modInv;
    if (n-r<r)
        r=n-r;
    if (r!=0)
    {
        while (r)
        {
            p=(p*n)%MOD;
            k*=r;
            n--;
            r--;
        }
        extendedEuclid(k, MOD);
        modInv=(x+MOD)%MOD;
        p=(p*modInv)%MOD;
    }
    else
        p=1;
    return p;
}

*/
// A modular inverse based solution to

int dp[102][100003];
int32_t main(void)
{
    int t=1;
    //cin>>t;
    while(t--)
    {
       int n,k;
       cin>>n>>k;

       for(int i=0;i<=n;i++)
        for(int j=0;j<=k;j++)
            dp[i][j]=0;
       for(int i=1;i<=n;i++)
        dp[i][0]=1;
        int c=0;
       for(int i=1;i<=n;i++)
       {
           int temp;
           cin>>temp;
           c=c+temp;
           if(c>k)
            c=k;
           for(int j=1;j<=temp;j++)
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
           for(int j=temp+1;j<=c;j++)
            dp[i][j]=dp[i][j-1]-1;
           if(dp[i][j]<0)
            dp[i][j]+=MOD;
       }
       cout<<dp[n][k]<<endl;

    }

}
