from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

# N < 100 , K < 10^5
N,K = inpl()
aa = inpl()

dp = [[0]*(K+1) for _ in range(N)]
# dp[i][k] : i人目までに k個を配る場合の数
# dp[i][k] = sum(a=0,aa[i]) dp[i-1][k-a]
#          = sum(x=k-aa[i],k) dp[i-1][x]


for k in range(aa[0]+1):
    dp[0][k] = 1

for i in range(1,N):
    tmp = 0
    rdp = [0]*(K+2)
    for k in range(K+1):
        tmp += dp[i-1][k]
        tmp %= mod
        rdp[k+1] = tmp

    a = aa[i]
    for k in reversed(range(K+1)):
        dp[i][k] = (rdp[k+1] - rdp[max(k-a,0)])%mod

print(dp[-1][-1])
