/*"Everything in the universe is balanced. Every disappointment
   you face in life will be balanced by something good for you!
                Keep going, never give up."            */

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


#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ordered_set<int>  os;
#define up_bound(i) os.order_of_key(i) << endl; // the number of elements in the os less than i
#define access_idx(i) *os.find_by_order(i) // print the i-th smallest number in os(0-based)

typedef double f80;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){uniform_int_distribution<int> uid(l, r); return uid(rng); }

#define ll long long int
#define ld double 
#define rep(i,a,b) for(int i=a; i<=b; ++i)
#define repd(i,a,b) for(int i=a; i>=b; --i)
#define deb cerr << "Line no." << __LINE__
#define nl '\n'
#define pb push_back
#define all(a) a.begin(),a.end()
#define P pair<ll,ll> 
#define F first
#define S second
const ll p_mod=9999999999999983;
const long double pi = 3.14159265358979323;
const ll N=1e6+9;
const ll mod=1e9+7;
ll powerk(ll x, ll y);
ll mul(ll x, ll y);
ll add(ll x, ll y);
ll sub(ll x, ll y);

ll a[N],dp[101][100005];

void solve()
{    
  ll n,m;
  cin>>n>>m;
  rep(i,1,n)cin>>a[i];
  rep(i,0,m)dp[0][i]=1;
  rep(i,1,n)
  {
  	rep(j,0,m)
  	{
  		if(j<=a[i])
  		dp[i][j] = add(dp[i][j],dp[i-1][j]);
  		else{
  			dp[i][j] = add(dp[i][j],dp[i-1][j]-dp[i-1][j-a[i]-1]);
  		} 
  		dp[i][j] = add(dp[i][j],dp[i][j-1]);
  		//cout<<dp[i][j]<<" ";
  	}
  	//cout<<nl;
  }
  cout<<dp[n][m]-dp[n][m-1];

}


int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t=1;
    //pre();
    //cin>>t;
    while(t--)
    {
      solve();
    }  
}
ll mul(ll x, ll y){return (x*y)%mod;}
ll add(ll x, ll y){return (x+y)%mod;}
ll sub(ll x, ll y){return (x-y+mod)%mod;}
ll powerk(ll x, ll y)
{
  if(y==0)return 1;
  if(y==1)return x%mod;
  if(y&1)
    return ((powerk((x*x)%mod, y/2)%mod)*x)%mod;
  else return powerk((x*x)%mod,y/2)%mod;
}

// Xorawar