from collections import defaultdict

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

NOW={0:1}#そこまでの飴の個数,場合の数

for i in range(N):
    NEXT=defaultdict(int)
    for now in NOW:
        for j in range(A[i]+1):
            if now+j<=K:
                NEXT[now+j]=(NEXT[now+j]+NOW[now])%mod

    NOW=NEXT
    #print(NOW)

print(NOW[K])