n,k=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7
dp=[0]*(k+2)
dp[0]=1
for a in A:
    for i in range(1,k+1):
        dp[i]+=dp[i-1]
    for i in range(k,0,-1):
        dp[i]=(dp[i]-dp[max(0,i-a)-1])%mod
print(dp[k])