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

#define VIC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfi(x) scanf("%d", &x)
#define sfi2(x, y) scanf("%d%d", &x,&y)
#define sfl2(x, y) scanf("%I64d%I64d", &x,&y)
#define sfl(x) scanf("%I64d", &x)
#define sfd(x) scanf("%lf", &x)
#define sfd2(x, y) scanf("%lf%lf", &x, &y)
#define sfs(x) scanf("%s", &x)
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;
const int N = 1e2 + 2, K = 1e5 + 5, mod = 1e9 + 7;
//g++ -std=c++11 main.cpp && a.exe


inline add(int x, int y)
{
    x += y;
    if (x >= mod)
        x -= mod;
    return x;
}

inline sub(int x, int y)
{
    x -= y;
    if (x < 0)
        x += mod;
    return x;
}

int n, k, a[N], dp[N][K], prefix[N][K];

int solve()
{
    for (int i = 0; i <= n; i++)
        prefix[i][0] = dp[i][0] = 1;
    for (int i = 0; i <= k; i++)
        prefix[0][i] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= k; j++)
        {
            int first = (j - a[i] - 1 >= 0? prefix[i - 1][j - a[i] - 1]: 0);
            int last = prefix[i - 1][j];
            dp[i][j] = add(dp[i][j], sub(last, first));
            prefix[i][j] = add(dp[i][j], prefix[i][j - 1]);
        }
    return dp[n][k];
}

int main()
{
    VIC
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    cout << solve();
    return 0;
}
