#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
const ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x);
        }
        p = p >> 1;
        x = (x*x);
    }
    return res;
}

int n,k;
int a[105];
ll dp[105][100005];

int main() {
    IO;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    dp[n - 1][0] = 1;
    for (int i = 1; i <= k; i++) {
        dp[n - 1][i] = dp[n - 1][i - 1];
        if (i <= a[n - 1])
            dp[n - 1][i] = (1 + dp[n - 1][i])%MOD;
    }
    for (int i = n - 2; i >= 0; i--) {
        for (int j = 0; j <= k; j++) {
            if (j) {
                dp[i][j] = dp[i][j - 1];
            }
            dp[i][j] = (dp[i][j] + (dp[i + 1][j] - dp[i + 1][max(0,j - a[i] - 1)] + (((j - a[i] - 1) < 0)?dp[i + 1][0]:0))%MOD)%MOD;
        }
    }
    cout << dp[0][k] -(k == 0?0:dp[0][k -1]);
    return 0;
}
