#!/mnt/c/Users/moiki/bash/env/bin/python
N,K = map(int, input().split())
# *A = map(int, input().split())
A = list(map(int, input().split()))
dp = [ [0]*(K+1) for _ in range(N+1)]

dp[0][K]= 1
MOD= int(1e9+7)

for i in range(N): # i+1$B$K(B
    for k in range(K, -1, -1):

        for ai in range(A[i]+1): # ai = 0 to Ai
            if k - ai >= 0:
                dp[i+1][k-ai] += dp[i][k] % MOD
            # print("dp[{ip1}][{kai}] += dp[{i}][{k}]".format(ip1=i+1, kai=k-ai, i=i, k=k))
# print(dp[N][K])
print(dp[N][0] % MOD)
# print(dp)
