import sys
import numpy as np

n, k = map(int, input().split())
a = list(map(int, input().split()))
cs_a = list(np.cumsum(a)) #累積和

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

for i in range(k + 1):
    for j in range(1, n + 1):
        if i > cs_a[j - 1]:
            dp[i][j] = 0
        elif i == 0:
            dp[i][j] = 1
        elif i == 1:
            dp[i][j] = dp[i][j - 1] + min(1, a[j - 1])
        else:
            dp[i][j] = sum(dp[i - x][j - 1] for x in range(a[j - 1] + 1))
            
print(dp[k][n] % (10 ** 9 + 7))

