// Slower C++ solution:
#include <iostream>

#include <bits/stdc++.h>

#include <cmath>

#include <vector>

#define ll long long int

#define mp make_pair

#define pb push_back

#define vi vector<int>

using namespace std;

using namespace std::chrono;

long long int p=1e9 +7;

ll n,k;

ll seq[105];

bool debugging=0;

bool outputcheck=0;

bool timecheck=0;

void init(){

    if(debugging){

        

    }

    else{

        cin>>n>>k;

        for(int i=0;i<n;i++){

            cin>>seq[i];

        }

    }

}

long long int modpower(ll b,ll po, ll mod=p){

    long long int ans=1;

    while(po){

        if(po&1){

            ans*=b;

            ans%=mod;

        }

        b*=b;

        b%=mod;

        po>>=1;

    }

    return ans;

}

ll solve(){

    ll ans[n+1][k+1];

    ll sum[n+1][k+2];

   for(int i=0;i<=n;i++){

       for(int j=0;j<=k;j++){

           ans[i][j]=0;

           sum[i][j]=0;

       }

       sum[i][k+1]=0;

   }

   ans[0][0]=1;

   for(int i=1;i<=k+1;i++){

       sum[0][i]=1;

   }

   for(int i=1;i<=n;i++){

       for(ll j=0;j<=k;j++){

           ans[i][j]=sum[i-1][j+1]-sum[i-1][max(0ll,j-seq[i-1])];

           ans[i][j]%=p;

       }

       for(int j=1;j<=k+1;j++){

           sum[i][j]=sum[i][j-1]+ans[i][j-1];

           sum[i][j]%=p;

       }

   }

   /*

   for(int i=0;i<=n;i++){

       for(int j=0;j<k+1;j++){

           cout<<ans[i][j]<<" ";

       }

       cout<<"\n";

   }

    for(int i=0;i<=n;i++){

       for(int j=0;j<=k+1;j++){

           cout<<sum[i][j]<<" ";

       }

       cout<<"\n";

   }

   */

   return (ans[n][k]%p + p)%p;

}

ll solvebad(){



}

int output(){

   

}

int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

	int t;

	//cin >>t;

	t=1;

    srand(time(0));

	while(t--){

	   init();

	   if(debugging){

	       if(outputcheck){

	          if(solve()!=solvebad()){//checking for random input

	             output();

	          }

	       }

	       if(timecheck){

	           auto start=high_resolution_clock::now();

	           solve();

	           auto stop=high_resolution_clock::now();

	           auto duration = duration_cast<microseconds>(stop - start);

	           cout<<duration.count()<<" Fast\n";

	           start=high_resolution_clock::now();

	           solvebad();

	           stop=high_resolution_clock::now();

	           duration = duration_cast<microseconds>(stop - start);

	           cout<<duration.count()<<" Slow\n";

	       }

	   }

	   else{

	       cout<<solve()<<"\n";//solving it correctly

	   }

	}

}

// Faster C++ solution for the same problem (measured speedup: 1.1313704618748142x):
#include <iostream>

#include <bits/stdc++.h>

#define mp make_pair

#define pb push_back

using namespace std;

using ll = long long int;

const int p = 1e9 + 7;

void solve(){

    int n,k;

    cin>>n>>k;

    vector<int> seq(n);

    for(auto &x : seq){

        cin>>x;

    }

    vector<int> dp(k+2);

    dp[0] = 1;

    for(int i=0;i<n;i++){

        for(int j=k,l=0,r=0;j>=0;--j){

            l = r;

            r = dp[j];

            dp[j] = dp[j+1] + dp[max(0, j-seq[i])] - l;  

            dp[j] >=p ? dp[j]-=p : dp[j];

            dp[j] < 0 ? dp[j]+=p : dp[j]; 

        }

    }

    cout<<dp[k]<<"\n";

}

int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    solve();

}