import sys

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

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

mod=10**9+7


for n in range(N):
	a=A[n]  #ame
	for k in range(K+1):
		if dp[n][k]!=0:
			for j in range(a+1):	#ame
				if 0<=k+j<=K:
					dp[n+1][k+j]+=dp[n][k]

print dp[N][K]%mod