#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define endl "\n"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll N = 1e5 + 10, inf = 1e18 + 10, mod = 1e9 + 7;
ll d[110][N], dp[N], a[110];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("prices.in", "r", stdin);
    //freopen("prices.out", "w", stdout);
    ll n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)cin >> a[i];
    for(int i = 1; i <= k + 1; i++)
    {
        if(i <= a[1] + 1)d[1][i] = 1;
        dp[i] = dp[i - 1] + d[1][i];
    }
    for(int i = 2; i <= n; i++)
    {
        for(int j = 1; j <= k + 1; j++)
        {
            d[i][j] = (dp[j] - dp[max(0ll, j - a[i] - 1)]) % mod;
        }
        dp[1] = 1;
        for(int j = 2; j <= k + 1; j++)
        {
            dp[j] = (dp[j - 1] + d[i][j]) % mod;
        }

    }
    cout << d[n][k + 1];
}
