import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

dp = [0] * (K + 1)
dp[K] = 1
for i in range(N):
  x = a[i]
  imos = [0] * (K + 2)
  for j in range(K + 1):
    if j - x >= 0:
      imos[j - x] += dp[j]
      imos[j - x] %= mod
    else:
      imos[0] += dp[j]
      imos[0] %= mod
    imos[j + 1] -= dp[j]
    imos[j + 1] %= mod
  for j in range(K + 1):
    imos[j + 1] += imos[j]
    imos[j + 1] %= mod
  for j in range(K + 1):
    dp[j] = imos[j]
print(dp[0])