from itertools import accumulate

N, K = map(int, input().split())
*A, = map(int, input().split())

mod = 10**9 + 7

dp = [0]*(K+1)
dp[0] = 1

for i, a in enumerate(A):
    dp = list(accumulate(dp))
    for j in range(K, a, -1):
        dp[j] -= dp[j-a-1]
        dp[j] %= mod

print(dp[K] % mod)
