from itertools import accumulate

N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = 10**9 + 7
DP = [0] * (K+2)
DP[0] = 1
for a in A:
    D = [0] * (K+2)
    for i, d in enumerate(DP):
        if d > 0:
            D[i] += d
            D[min(K+1, i + a + 1)] -= d
    for i in range(1, K+2):
        D[i] += D[i-1]
        D[i] %= mod
    DP = D
print(DP[K])