n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
mod=pow(10,9)+7
z=[[0]*(k+1) for i in xrange(n+1)]
z[0][0]=1
for i in xrange(n):
  for j in xrange(k):
	z[i][j+1]+=z[i][j]
  for j in xrange(k+1):
    z[i+1][j]=z[i][j]
    if j-a[i]-1>=0:
      z[i+1][j]-=z[i][j-a[i]-1]
print z[n][k]%mod