#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e2 + 5;
const int MAXK = 1e5 + 5;
const int MOD = 1e9 + 7;
int arr[MAXN];
int dp[MAXN][MAXK];
int sum[MAXN][MAXK];
int32_t main(){
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    for(int i = 0; i < n; i++){
        dp[i][0] = 1;
        sum[i][0] = 1;
    }
    for(int j = 1; j <= k; j++){
        if(j <= arr[0]) dp[0][j] = 1;
        sum[0][j] = (dp[0][j] + sum[0][j - 1]) % MOD;
    }
    for(int i = 1; i < n; i++){
        for(int j = 1; j <= k; j++){
            if(j - arr[i] - 1 >= 0)
                dp[i][j] = ((sum[i - 1][j] - sum[i - 1][j - arr[i] - 1] + MOD)) % MOD;
            else
                dp[i][j] = (sum[i - 1][j])%MOD;
        }
        for(int j = 1; j <= k; j++){
            sum[i][j] = (MOD + dp[i][j] + sum[i][j - 1])%MOD;
        }
    }
    cout << (dp[n - 1][k] << '\n';
}
