#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll mod = 1e9 + 7, s = 0;

    ll dp[110][100010] = {0};

    dp[0][k] = 1;

    forx(i,1,n+1)rep(j,k+1){
        if(j==0){
            s = 0;
            rep(l, a[i-1] + 1){
                s += dp[i-1][l];
                s %= mod;
            }
        }
        else
            s += (dp[i-1][j + a[i-1]] - dp[i-1][j - 1]);
        dp[i][j] += s;
        dp[i][j] %= mod;
    }

    cout << dp[n][0] << endl;

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll mod = 1e9 + 7, s = 0;

    ll dp[110][100010] = {0};

    dp[0][k] = 1;

    forx(i,1,n+1)rep(j,k+1){
        if(j==0){
            s = 0;
            rep(l, a[i-1] + 1){
                s += dp[i-1][l];
                s %= mod;
            }
        }
        else
            s += (dp[i-1][j + a[i-1]] - dp[i-1][j - 1]);
        dp[i][j] += s;
        dp[i][j] %= mod;
    }

    cout << dp[n][0] << endl;

    return 0;
}
