import sys
sys.setrecursionlimit(10**9)

BIG_INT = 10 ** 9 + 7

def dpcalc(n, k):
    if dp[n][k] != -1:
        return dp[n][k]
    
    res = 0
    for i in range(min(k, A[n-1]) + 1):
        res += dpcalc(n - 1, k - i)
    
    dp[n][k] = res
    return res


N, K = map(int, input().split())
A = [int(x) for x in input().split()]

dp = [[-1] * (K +1) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(1, K + 1):
    dp[0][i] = 0

print(dpcalc(N, K)  % BIG_INT)
