N,K = map(int, input().split())
A = list(map(int, input().split()))

memo = []
for i in range(K+1):
    l = [None] * N
    memo.append(l)

def rec(remaining, i):
    if i == N:
        if remaining > 0:
            return 0
        else:
            return 1

    if memo[remaining][i] != None:
        return memo[remaining][i]

    a = A[i]
    max_take = min(remaining, a)

    res = 0
    for take in reversed(range(0, max_take+1)):
        assert(remaining >= take)
        res += rec(remaining-take, i+1)

    if memo[remaining][i] == None:
        memo[remaining][i] = res

    return res

print(rec(K, 0) % 1000000007)