#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9 + 7;
const int INT_MOD=1e9+7;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 0; i <= n; i++)
#define rrep(i,n) for(int i=n;i>0;i--)
#define RREP(i,n) for(int i=n;i>=0;i--)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
ll dp[103][100005]={};
ll total[100003];
signed main(){
    int n,k;
    cin>>n>>k;
    int a[n+1]={};
    for(int i=1;i<n+1;i++) cin>>a[i];
    dp[0][0]=1;
    for(int i=1;i<n+1;i++){
        total[0]=0;
        for(int j=1;j<=k+1;j++) total[j]=(total[j-1]+dp[i-1][j-1])%MOD;
        rep(j,k+1) dp[i][j]=(total[j+1]-total[max(0,j-a[i])])%MOD;
    }
    cout<<dp[n][k]<<endl;
    return 0;
}