import sys
import numpy as np
M = 10 ** 9 + 7
readline = sys.stdin.buffer.readline
N, K = map(int, readline().split())
a = np.array([int(x) for x in readline().split()], dtype=np.int64)
dp = np.zeros(K + 1, dtype=np.int64)
dp[0] = 1
for x in a:
 dp = np.cumsum(dp)
 dp[x+1:] -= dp[:-x-1]
 dp %= M
print(dp[K])
