def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    mod = 10**9+7

    dp = [[0]*(k+2) for i in range(n+1)]
    # dp[i][j]: i人目まで配ったときに残っているアメの個数がj個となる場合の数
    from itertools import accumulate
    dp[0][k] = 1
    for i in range(n):
        x = [0]*(k+2)
        for j in range(k+1):
            x[max(0, j-A[i])] += dp[i][j]%mod
            x[j+1] -= dp[i][j]%mod
        cum = list(accumulate(x))
        dp[i+1] = cum

    print(dp[n][0]%mod)

if __name__ == '__main__':
    main()