#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

ll dp[101][100001];

int main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        dp[i+1][0]=1;
        for(int j=1;j<=a[i];j++){
            dp[i+1][j]=(dp[i+1][j-1]+dp[i][j])%MOD;
        }
        for(int j=a[i]+1;j<=k;j++){
            dp[i+1][j]=(dp[i+1][j-1]+dp[i][j]-dp[i][j-a[i]-1]+MOD)%MOD;
        }
    }
    cout<<dp[n][k]<<endl;
}