#include <bits/stdc++.h>
using namespace std;
using ii = long long;
const ii mod = 1e9+7;
ii _dp[2][100100];
#define dp _dp[z]
#define pd _dp[!z]
int main()
{
    int n, k, z = 1;
    cin >> n >> k;
    dp[0] = 1;
    for (int i = 1; i <= n; ++i) {
        z = !z;
        int x;
        cin >> x;
        ii s = 0;
        for (int j = 0; j <= k; ++j) {
            s += pd[j];
            s %= mod;
            dp[j] = s;
            if (j >= x) {
                s = (s - pd[j - x] + mod) % mod;
            }
        }
    }
    cout << dp[k] << "\n";
}
