#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define rep(x,n) for(int x = 0 ; x < n ; x++)
#define pb push_back
#define all(c) (c).begin() , (c).end()
const ll mod = 1e9 + 7;
vi dp(1e5+10, 0);

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n)   cin >> a[i];
    
    rep(i, a[0] + 1)
        dp[i] = 1;
    
    for (int i = 1; i < n; i++)
        for (int j = 1; j <= k ; j++)
            if (j - a[i] <= 0)
                (dp[j] += dp[j-1]) %= mod;
            else
                dp[j] = (max(dp[j] + dp[j - 1] - a[j - a[i]- 1], 0) + mod) % mod;
    cout << dp[k] << endl;
    return 0;
}