#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
 
// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
using namespace __gnu_pbds;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const int INF = 1e16;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9 + 7;

int dp[102][100005];

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n, k;
    cin >> n >> k;
    vector<int> v(n+1);
    for(int i = 1; i <= n; i++)
        cin >> v[i];
    dp[0][0] = 1;
    vector<int> pref(k+1);
    for(int i = 1; i <= n; i++)
    {
        pref[0] = dp[i-1][0];
        for(int s = 1; s <= k; s++)
        {
            pref[s] = pref[s-1] + dp[i-1][s];
            pref[s] %= mod;
        }
        for(int j = 0; j <= k; j++)
        {
            dp[i][j] = pref[j] - (j > v[i] ? pref[j-v[i]-1] : 0);
            dp[i][j] %= mod;
        }
    }
    cout << dp[n][k] << endl;
    return 0;
}