N, K = map(int, input().split())
a = [-1] + list(map(int, input().split()))

MOD = 10**9 + 7

dp = [[0]*(K+1) for _ in range(N+1)]
for i in range(N+1):
    dp[i][0] = 1

for i in range(N):
    for j in range(K):
        if j - a[i+1] >= 0:
            dp[i+1][j+1] = (dp[i+1][j] + dp[i][j+1] - dp[i][j - a[i+1]]) % MOD
        else:
            dp[i+1][j+1] = (dp[i+1][j] + dp[i][j+1]) % MOD

print(dp[N][K])