#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define per(i,b,a) for(int i=b; i>=a; i--)
#define pb push_back
#define fi first
#define se second
using namespace std ;
typedef pair<int, int> pi ;
typedef vector<pair<int,int> > vpi ;
typedef vector<int> vi ;
typedef long long ll ;
const int MOD = 1e9 + 7;
const int inf = 1e9 + 5;
ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
const int maxn = 105 ;
int n, k ;
int a[maxn] ;
ll dp[maxn][100005] ;
ll ps[100005] ;

inline int add(int a, int b){
    a += b;
    if(a >= MOD)a -= MOD;
    return a;
}

inline int sub(int a, int b){
    a -= b;
    if(a < 0)a += MOD;
    return a;
}

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cin >> n >> k ;
    rep(i,0,n-1)
    {
        cin >> a[i] ;
    }
    rep(i,0,a[0])
    {
        dp[0][k-i] = 1 ;
        ps[0] = dp[0][0] ;
        rep(j,1,k)
        {
            ps[j] = add(ps[j - 1], dp[0][j]);
        }
    }
    rep(i,1,n-1)
    {
        rep(j,0,k)
        {
           int l = j ;
           int r = min(j + a[i], k) ;
           if(l > 0)
            dp[i][j] = sub(ps[r], ps[l - 1]);
           else
            dp[i][j] = ps[r];
        }
        rep(i,0,100004) ps[i] = 0 ;
        ps[0] = dp[i][0] ;
        rep(j,1,k)
            ps[j] = add(dp[i][j], ps[j - 1]);
    }
    ll res = dp[n-1][0] ;
    cout << res << "\n" ;
    return 0 ;
}
