from itertools import accumulate, starmap
from operator import sub

n, k = map(int, input().split())
aaa = list(map(int, input().split()))
MOD = 10 ** 9 + 7
dp = [0] * (k + 1)
dp[0] = 1
for a in aaa:
    dp = list(accumulate(dp))
    dp[a + 1:] = starmap(sub, zip(dp[a + 1:], dp[:-a - 1]))
    dp = [x % MOD for x in dp]
print(dp[k])
