import itertools

N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7

NOW=[0]*(K+1)
NOW[0]=1#そこまでi個使ったときの場合の数


for i in range(N):
    NEXT=[0]*(K+1)
    NOWSUM=list(itertools.accumulate(NOW))
        
    for j in range(K+1):
        if j-A[i]-1>=0:
            NEXT[j]=(NEXT[j]+NOWSUM[j]-NOWSUM[j-A[i]-1])%mod
        else:
            NEXT[j]=(NEXT[j]+NOWSUM[j])%mod
            

    NOW=NEXT
    #print(NOWSUM,NOW)

print(NOW[K])