from itertools import accumulate

N,K = map(int, input().split())

A = list(map(int, input().split()))

MOD = int(1e9+7)

dp = [0] * (K+1)
dp[0] = 1

for n in range(N):

    sumlist = [0]
    sumlist += dp[:]
    sumlist = list(accumulate(sumlist))

    ndp = [0] * (K+1)
    for k in range(K+1):
        ndp[k] = sumlist[k+1] - sumlist[max(0, k - A[n])] 
        ndp[k] %= MOD
    dp = ndp
                # dp[k] ~ dp[k-A[n]] made
print(dp[K]%MOD)

