#!/usr/bin/env crystal
Memo=Hash(Tuple(Int32,Int32),Int32).new
def dfs(d,k)
	if d==A.size
		return k==0 ? 1 : 0
	end
	x={d,k}
	if Memo.has_key?(x)
		return Memo[x]
	end
	r=0
	(0..[k,A[d]].min).each{|i|r=(r+dfs(d+1,k-i)) % (10**9+7)}
	Memo[x]=r
end
	
A=ARGF.gets_to_end.split.map &.to_i
n,k=A.shift(2)
p dfs(0,k)
