from itertools import accumulate

def solve():
    MOD = 10**9 + 7

    N, K = map(int, input().split())
    As = list(map(int, input().split()))

    dp = [0] * (K+1)
    dp[0] = 1
    for A in As:
        dp = list(accumulate(dp))
        for j, d in enumerate(dp[:K-A], start=A+1):
            dp[j] -= d
        dp = [dpi % MOD for dpi in dp]

    print(dp[K])


solve()
