import numpy as np

n, k = map(int, input().split())
aaa = list(map(int, input().split()))
MOD = 10 ** 9 + 7
dp = np.zeros(k + 1, dtype=np.int64)
dp[0] = 1
for a in aaa:
    dp = dp.cumsum(dtype=np.int64)
    dp %= MOD
    dp[a + 1:] -= dp[:-a - 1]
    dp %= MOD
print(dp[k])
