n,k=map(int,input().split())
a=list(map(int,input().split()))

m=10**9+7

dp=[ [0]*(k+1) for _  in range(n+1) ]
dp[0][0]=1

for i in range(n):
    for j in range(k+1):
        if j-a[i]>=0:
            dp[i+1][j]=sum( dp[i][j-a[i]:j+1 ])
        else:
            dp[i+1][j]=sum( dp[i][0:j+1 ])

print(dp[n][k]%m)