n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [[0] * (n + 1) for _ in range(k + 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):
        for w in range(min(a[j - 1], i) + 1):
            dp[i][j] += dp[i - w][j - 1]
        dp[i][j] %= (10 ** 9 + 7)
print(dp[k][n])