# -*- coding: utf-8 -*-
import sys

N,K=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())

dp=[ [] for i in range(N+1) ]
dp[0]=[1]

mod=10**9+7


for n in range(N):
	W=[0]		#WA:累積和
	L=dp[n]
	l=len(L)
	a=A[n]
	for j,x in enumerate(L):
		if j==0:	W.append(x)
		else:	W.append( W[-1]+x )

	T=[]  #Temporary
	for k in range( min (K+1,a+l) ):
		#print k, min( k+1, l), max(0,k-a), W[min( k+1, l)]-W[max(0,k-a)]
		T.append( W[min( k+1, l)]-W[max(0,k-a)] )

	dp[n+1]=T



try:
	print dp[N][K]%mod
except IndexError:
	print 0