mod = 10**9+7
N, K = map(int, input().split())
A = list(map(int, input().split()))

dp = [0]*(K+1)
dp[0] = 1
for a in A:
    dp2 = [0]*(K+1)
    for i in range(K+1):
        dp2[i] += dp[i]
        if i + a + 1 <= K:
            dp2[i+a+1] -= dp[i]
    for i in range(1, K+1):
        dp2[i] = (dp2[i-1] + dp2[i]) % mod
    dp = dp2[:]
print(dp[-1])