mod=1000000007
# from https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0106_educational_dp
from itertools import accumulate, starmap
from operator import sub

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