N, K = map(int, input().split())
A = list(map(int, input().split()))

if sum(A) < K:
  print(0)
  exit(0)

#import random
#N = 3000
#A = [random.randint(1, 10**9) for _ in range(N)]
dp = [[0] * (K+1) for _ in range(N+1)]
dp[-1][0] = 1
M = 10**9 + 7
for i in range(N):
  a = A[i]
  for j in range(a+1):
    for k in range(K-j+1):
      dp[i][k+j] += dp[i-1][k]
      dp[i][k+j] %= M

#for r in dp:
#  print(r)
print(dp[N-1][K])

