n,k=map(int,input().split())
li=[int(k) for k in input().split()]
tot=0
ans=0
def findans(tot,li,j,k):
    global ans
    if k-tot==0 :
        ans+=1
    
        return 1
    if k<0:
        return 0
    if j==len(li):
        return 0    
    for i in range(li[j]+1):
        
        x=findans(tot+i,li,j+1,k)
    
    
findans(0,li,0,k)
mod=10**9+7
print(ans%mod)

    