
#include<bits/stdc++.h>
using namespace std ; 
#define MOD 1000000007
long long int dp[105][100005] ; 
int solve(int n,int k,int arr[]){
   if(n==1 && k<=arr[n] && k>=0){
       return 1 ; 
   }else if(n==1 && k>arr[n]){
       return 0 ; 
   }
    if(dp[n][k]!=-1){
        return dp[n][k]%MOD ;
    }
    long long int ways = 0 ; 
    for(int i =0 ; i<=arr[n] ; i++){
        ways+= (solve(n-1,k-i,arr))%MOD ; 
    }
    return dp[n][k] = ways%MOD ; 
}
solve_bottomup(int n,int k,int arr[]){
    //this has much better time complexity . 
    for(int j=0 ; j<=k ;j++){
        dp[1][j] = (j>arr[1])? 0 : 1 ; 
    } //covers the base cases . 
    for(int i = 2 ; i<=n ; i++){
        for(int j =0 ; j<=k ; j++){
            if(j==0){
                dp[i][j] = dp[i-1][j] ; 
            }else{
                dp[i][j] =(MOD+ dp[i][j-1]+dp[i-1][j]-( (j-arr[i]-1>=0) ? dp[i-1][j-arr[i]-1] : 0) )%MOD ; 
            }
        }
    }
return dp[n][k] ; 
}
int main(){
    int n,k ; cin>>n>>k ; 
    int arr[n+1] ; arr[0] = 0; 
    for(int i  = 1; i<=n ; i++){
        cin>>arr[i] ; 
    }
    memset(dp,-1,sizeof(dp)) ; 
    cout<<solve_bottomup(n,k,arr) ; 
}