#include <bits/stdc++.h>
using namespace std;
#define int long long
#define nn 100005
#define m 1000000007
int dp[nn][102];
int arr[102];
int cnt[102] = {0};
int n;
int solve(int in, int k) {
    //    cout << in << " " << k  << endl;
    if (k <= 0)
        return 1;
    if (in == n)
        return 0;
    if (dp[in][k] == -1) {
        int ans = 0;
        int l;
        for (l = 0; l <= arr[in]; l++) {
            if (k < l)
                break;
            ans += solve(in + 1, k - l);
        }
        dp[in][k] = ans;
    }
    return dp[in][k] % m;
}
main() {
    int k;
    memset(dp, -1, sizeof(dp));
    cin >> n >> k;
    int i;
    for (i = 0; i < n; i++) {
        cin >> arr[i];
    }
    cout << solve(0, k);
}