#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
class mint {
 private:
  ll _num,_mod;
  constexpr mint set(const ll &num){ 
      _num = num ;
      if(_num<0){
          if(_num>=-_mod)_num=_mod+_num;
          else _num=_mod-(-_num)%_mod;
      }
      else if(_num>=_mod) _num%=_mod;
      return *this;
  }
  constexpr ll imod()const{
    ll n=_mod-2,ans = 1,x=_num;
    while(n){
        if(n&1) ans = ans*x%_mod;
        x = x*x%_mod;
        n = n >> 1;
    }
    return ans;
  }
 public:
  explicit constexpr mint(const ll &num=0,const ll &M=1000000007):_num(num),_mod(M){
      _num = num ;
      if(_num<0){
          if(_num>=-_mod)_num=_mod+_num;
          else _num=_mod-(-_num)%_mod;
      }
      else if(_num>=_mod) _num%=_mod;
  }
  constexpr mint(const mint &cp):_num(cp._num),_mod(cp._mod){}
  
  constexpr mint operator+ (const mint &x)const{ return mint(_num + x._num , _mod); }
  constexpr mint operator- (const mint &x)const{ return mint(_num - x._num , _mod);}
  constexpr mint operator* (const mint &x)const{ return mint(_num * x._num , _mod); }
  constexpr mint operator/ (const mint &x)const{ return mint(_num * x.imod() , _mod);}
  
  constexpr mint operator+=(const mint &x){ return set(_num + x._num); }
  constexpr mint operator-=(const mint &x){ return set(_num - x._num); }
  constexpr mint operator*=(const mint &x){ return set(_num * x._num); }
  constexpr mint operator/=(const mint &x){ return set(_num * x.imod());}

  constexpr mint operator= (const ll &x){ return set(x); }
  constexpr mint operator+ (const ll &x)const{return *this + mint(x,_mod); }
  constexpr mint operator- (const ll &x)const{ return *this - mint(x,_mod); }
  constexpr mint operator* (const ll &x)const{ return *this * mint(x,_mod); }
  constexpr mint operator/ (const ll &x)const{ return *this/mint(x);}

  constexpr mint operator+=(const ll &x){ *this = *this + x;return *this; }
  constexpr mint operator-=(const ll &x){ *this = *this - x;return *this; }
  constexpr mint operator*=(const ll &x){ *this = *this * x;return *this;}
  constexpr mint operator/=(const ll &x){ *this = *this / x;return *this;}

  friend constexpr mint operator+(const ll &x,const mint &m){return mint(m._num + x , m._mod);}
  friend constexpr mint operator-(const ll &x,const mint &m){return mint( x - m._num , m._mod);}
  friend constexpr mint operator*(const ll &x,const mint &m){return mint(m._num * (x % m._mod) , m._mod);}
  friend constexpr mint operator/(const ll &x,const mint &m){return mint(m.imod() * (x % m._mod) , m._mod);}

  explicit operator ll() { return _num; }
  explicit operator int() { return (int)_num; }
  
  friend std::ostream& operator<<(std::ostream &os, const mint &x){ os << x._num; return os; }
  friend std::istream& operator>>(std::istream &is, mint &x){ll val; is>>val; x.set(val); return is;}
};
int main(){
    int N,K;
    int a[100];
    cin>>N>>K;
    REP(i,N) cin>>a[i];
    vector<vector<mint>> dp(N+1,vector<mint>(2*K+2));
    dp[N][K]=1;
    for(int i=N-1;i>=0;--i) for(int j=K;j>=0;--j){
        dp[i][j]=dp[i+1][j]+dp[i][j+1]-dp[i+1][j+a[i]+1];
    }
    cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 319232