from itertools import accumulate

mod = 10 ** 9 + 7

N, K, *A = map(int, open(0).read().split())

dp = [1] + [0] * K
for a in A:
    S = list(accumulate(dp)) + [0]
    for i in range(K + 1):
        dp[i] = (S[i] - S[max(0, i - a) - 1]) % mod

print(dp[K])