# n=int(input())
n,k=list(map(int,input().split(" ")))
a=list(map(int,input().split(" ")))
a.sort()
m=(10**9)+7
mat=[[(1,1) for i in range(k+1)] for j in range(n+1)]
for j in range(1,k+1):
	for i in range(1,n+1):
		# i=i1-1
		if(j==1):
			if(i==1 and a[0]>0):
				x=1
				
			elif(i>0 and a[i-1]>0 ):
				x=mat[i-1][j][0]+1
				
			elif(i>0 and a[i-1]==0):
				x=mat[i-1][j][0]
				
		else:
			start=j-a[i-1]
			start=max(start,0)
			if(start==0):
				x=mat[i-1][j][1]
				
			else:
				x=mat[i-1][j][1]-mat[i-1][start-1][1]
		mat[i][j]=(x%m,(mat[i][j-1][1]+x)%m)
		# mat[i][j]=mat[i][j]%m
# print(mat)			

print(mat[n][k][0])