n, k = map(int, input().split())
a = list(map(int, input().split()))
MOD = 10**9 + 7

dp = [[0]*(k+1) for i in range(n+1)]
dp[0][0] = 1
ruiseki = [0] * (k+2)
for j in range(k+1):
    ruiseki[j+1] = ruiseki[j] + dp[0][j]

for i in range(n):
    for j in range(k+1):
        dp[i+1][j] = ruiseki[j+1] - ruiseki[max(j-a[i], 0)]
        dp[i+1][j] %= MOD
    ruiseki = [0] * (k+2)
    for j in range(k+1):
        ruiseki[j+1] = ruiseki[j] + dp[i+1][j]

print(dp[n][k])