import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

"""
(1+x+...+x^a) をたくさんかける
(1-x^{a+1}) をたくさんかけて、(1-x)^{-N}をかける
"""

import numpy as np
MOD = 10 ** 9 + 7
N,K = map(int,input().split())
P = np.zeros(K+1, dtype=np.int64)
Q = np.zeros(K+1, dtype=np.int64)
P[0] = 1
Q[0] = 1

for a in map(int,input().split()):
    P[a+1:] -= P[:-(a+1)]
    np.cumsum(Q, out=Q)
    P %= MOD
    Q %= MOD

answer = (P * Q[K::-1] % MOD).sum() % MOD
print(answer)