import numpy as np
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9+7
dp = np.zeros((N+10,K+10),dtype=np.int64)

for i in range(N):
    for k in range(K+1):
        if i == 0:#初期化
            dp[0,:A[0]+1] = 1
            break
        else:
            dp[i][k] = np.sum(dp[i-1, max(0,k-A[i]):k+1])
        dp[i][k] %= MOD
print(dp[N-1][K])