n, k = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
p = 10 ** 9 + 7

DP = [[0] * (k + 1) for i in range(n + 1)]
for i in range(n + 1):
    DP[i][0] = 1

for i in range(n):
    for j in range(k):
        DP[i+1][j+1] = DP[i + 1][j]
        DP[i+1][j+1] += DP[i][j+1]
        if j - A[i] >= 0: DP[i+1][j+1] -= DP[i][j - A[i]]
        DP[i+1][j+1] %= p
    
print(DP[n][k])