import numpy as np

n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = np.zeros((k + 1, n + 1))

for i in range(n + 1):
    dp[0][i] = 1
for i in range(a[0] + 1):
    dp[i][1] = 1

for i in range(1, k + 1):
    for j in range(2, n + 1):
        dp[i][j] = sum(dp[max(0, i - a[j - 1]):i + 1, j - 1]) % (10 ** 9 + 7)
print(int(dp[k][n]))