import copy
n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9+7
x = [1]*(a[0]+1)+[0]*(k-a[0])
for i in range(1,n):
  oldx = copy.copy(x)
  s = 0
  for j in range(a[i]+1):
    s = (s + oldx[j])%mod
    x[j] = s
  for j in range(a[i]+1,k+1):
    s = (s + oldx[j] -oldx[j-a[i]-1])%mod
    x[j] = s   
print(x[k])
    
    