#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll mod = (ll)1e9+7;
const int INF = 0x3f3f3f3f;

vector<int> v(105);
ll dp[105][100010]; //dp[child #][number of candies left] = possibilities up to this point

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //#ifndef ONLINE_JUDGE
    freopen("B.txt", "r", stdin);
    #endif
    int n, k;
    cin >> n >> k;
    for(int i=1; i<=n; i++)
        cin >> v[i];
    for(int i=0; i<=v[1]; i++) dp[1][i]=1;
    for(int i=2; i<=n; i++)
    {
        dp[i][0] = 1;
        for(int j=1; j<=100000; j++)
        {
            if(j>v[i])
            {
                dp[i][j] -= dp[i-1][j-v[i]-1];
            }
            dp[i][j] += (dp[i][j-1]+dp[i-1][j])%mod;

        }
    }
    cout << dp[n][k];
}
