#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
signed main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin>>n>>k;
    vector <int> a(n);
    rep(i,n) cin>>a[i];
    vector <vector<int>> dp(n+10,vector <int>(100010));
    vector <int> cum(100010);
    cum[0] = 0;
    dp[0][0] = 1;
    
    dp[0][0]=1;
    for(int i=1;i<n+1;i++){
	    cum[0]=0;
	    for(int j=1;j<n+1;j++){
            cum[j] = (cum[j-1] + dp[i-1][j-1]) % MOD;
        }
	    rep(j,k+1) dp[i][j]=(cum[j+1]-cum[max(0,j-a[i])]+MOD)%MOD;
    }
    ans=dp[N][K];
    cout<<dp[n][k]<<endl;
}
