#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;

typedef long long ll;
const int N(105), K(133333);
ll a[N], s[K];
ll dp[N][K];
int n, k;

int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int j = 0; j <= k; ++j)
        dp[0][j] = 0;
    for (int j = 0; j <= n; ++j)
        dp[j][0] = 1;
    for (int i = 1; i <= n; ++i)
    {
        s[0] = 0;
        for (int j = 1; j <= k + 1; j++)
            s[j] = (s[j - 1] + dp[i - 1][j - 1]) % mod;
        for (int j = 1; j <= k; j++)
        {
            dp[i][j] = s[j + 1] - s[max(0, j - a[i - 1])];
            dp[i][j] = dp[i][j] % mod;
        }
    }
    cout << dp[n][k];
    return 0;
}