#include <bits/stdc++.h>
#define int long long int
using namespace std;
int DP[101][100001] = {0};
signed main() {
    int n,k1;
    cin>>n>>k1;
    int cap[n+1];
    for(int i=1;i<=n;i++)
    cin>>cap[i];

    int cum[n+1] = {0};
    cum[1] = cap[1];
    for(int i=2;i<=n;i++ )
    cum[i]+=(cap[i] + cum[i-1]);
    //cout<<cum[1]<<cum[2]<<cum[3]<<endl;
    DP[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int k=0;k<=k1;k++)
        {
            if(i==0 && k==0)
            continue;
            if(k==0)
            {
                DP[i][k]=1;
                continue;
            }
            if(i==0)
            continue;

            if(cap[i]>=k)
            {
                DP[i][k] = DP[i][k-1] + DP[i-1][k];
                
                DP[i][k] = DP[i][k]%1000000007;
            }
            else
            {
                DP[i][k] = DP[i][k-1]  - DP[i-1][k-cap[i]-1];
                DP[i][k] = DP[i][k]%1000000007;
            }

        }
    }

    cout<<DP[n][k1]<<endl;

//    for(int i=0;i<=n;i++)
  //  {
//
//
  //      for(int k=0;k<=k1;k++)
    //    {
      //      cout<<DP[i][k]<<" ";
        //}
        //cout<<endl;
    //}

    //cout<<DP[3][3]<<DP[2][4]<<DP[2][0]%1000000007;
    return 0;
}
