#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 PII pair<int,int>
#define s second
#define f first
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
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)%MOD;
        }
        p = p >> 1;
        x = (x*x)%MOD;
    }
    return res;
}
int dp[101][100005];
int prefix[100005];
int getRangeSum(int l, int r){
    return prefix[r] - ((l-1 >= 0) ? prefix[l-1] : 0);
}
int main() {
    IO;
    int n, k;
    cin >> n >> k;
    int arr[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        prefix[0] = dp[i-1][0];
        for(int j = 1; j <= k; j++){
            prefix[j] = (prefix[j-1] + dp[i-1][j])%MOD;
        }
        for(int j = 0; j <= k; j++){
            int l = max(j-arr[i-1], 0);
            int r = j;
            dp[i][j] += getRangeSum(l, r);
            dp[i][j] %= MOD;
        }
    }
    cout << dp[n][k];



    return 0;
}
