n, k = map(int, input().split()) A = list(map(int, input().split())) mod = 10**9+7 dp = [1]*(k+1) for i in range(n): nx = [0]*(k+1) for j in range(k+1): if j-1-i >= 0: nx[j] =dp[j]-dp[j-1-i] else: nx[j] = dp[j] for j in range(1, k+1): nx[j] += nx[j-1] nx[j] %= mod dp = nx print(dp[k])