mod = 10**9+7
N, K = map(int, input().split())
a = list(map(int, input().split()))
# dp[j] := the number of ways to distribute j candies
dp = [0] * (K+1)
dp[0] = 1
for i in range(N):
    ndp = [0] * (K+1)
    ndp[0] = 1
    for j in range(1, K+1):
        ndp[j] = ndp[j-1] + dp[j]
        if j - a[i] - 1 >= 0:
            ndp[j] -= dp[j-a[i]-1]
        ndp[j] %= mod
    dp = ndp
print(dp[K])