#include <bits/stdc++.h>
using namespace std;

#define int long long
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
#define vi vector < int >
#define pii pair < int, int >

const int K = 1e5 + 7;
const int N = 107;
const int mod = 1e9 + 7;

int a[N], pr[N][K + 1], ar[N][K + 1];
int n, k;

main (){
    fill(pr[0], pr[0] + K + 1, 1);
    scanf("%lld%lld", &n, &k);
    for (int i = 1; i <= n; i++){
        scanf("%lld", &a[i]);
        for (int j = K; j >= 0; j--){
            ar[i][j] = pr[i - 1][j];
            if (j - a[i] - 1 >= 0){
                ar[i][j] -= (pr[i - 1][j - a[i] - 1] + mod) % mod;
            }
        }
        pr[i][0] = ar[i][0];
        for (int j = 1; j <= K; j++){
            pr[i][j] = pr[i][j - 1] + ar[i][j];
            pr[i][j] %= mod;
        }
    }
    cout << ar[n][k];
}
