#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
const int P = N+1, Q = K+1, mod = 1e9+7, null = -1;
using ivector = vector<int>;
ivector a(P);
for (int i = 1; i < P; ++i)
cin >> a[i];
vector<ivector> dp(P,ivector(Q,null));
const function<int(int,int)> solve = [&](int n, int k) {
// returns the number of ways to share (k) candies among the first
// (n) children such that the i-th child, 1 <= i <= n, gets v[i] candies,
// where 0 <= v[i] <= a[i] and v[1]+v[2]+....+v[n] = k.
if (n == 0 or k == 0) // base case
return int(k == 0);
if (dp[n][k] == null) { // recursive case
dp[n][k] = 0;
for (int p = n-1, q = k, v = 0; q >= 0 and v <= a[n]; --q, ++v)
dp[n][k] += solve(p,q), dp[n][k] %= mod; }
return dp[n][k]; };
cout << solve(N,K);
return 0; }
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBOLCBLOyAKCWNpbiA+PiBOID4+IEs7IAoJY29uc3QgaW50IFAgPSBOKzEsIFEgPSBLKzEsIG1vZCA9IDFlOSs3LCBudWxsID0gLTE7Cgl1c2luZyBpdmVjdG9yID0gdmVjdG9yPGludD47CglpdmVjdG9yIGEoUCk7Cglmb3IgKGludCBpID0gMTsgaSA8IFA7ICsraSkKCQljaW4gPj4gYVtpXTsKCXZlY3RvcjxpdmVjdG9yPiBkcChQLGl2ZWN0b3IoUSxudWxsKSk7Cgljb25zdCBmdW5jdGlvbjxpbnQoaW50LGludCk+IHNvbHZlID0gWyZdKGludCBuLCBpbnQgaykgewoJCS8vIHJldHVybnMgdGhlIG51bWJlciBvZiB3YXlzIHRvIHNoYXJlIChrKSBjYW5kaWVzIGFtb25nIHRoZSBmaXJzdCAKCQkvLyAobikgY2hpbGRyZW4gc3VjaCB0aGF0IHRoZSBpLXRoIGNoaWxkLCAxIDw9IGkgPD0gbiwgZ2V0cyB2W2ldIGNhbmRpZXMsCgkJLy8gd2hlcmUgMC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