n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9 + 7
dp = [[0] * (k+1) for i in range(n+1)]
dp[0][0] = 1
for j in range(1,n+1):
  rui = [0] * (k+2)
  for i in range(k+1):
    rui[i+1] += rui[i] + dp[j-1][i]
  for i in range(k+1):
    if i - a[j-1] >= 0:
      dp[j][i] = (rui[i+1] - rui[i-a[j-1]])%mod
    else:
      dp[j][i] = rui[i+1]%mod
print(dp[n][k]%mod)