N,K=gets.split.map(&:to_i)
as=gets.split.map(&:to_i)
as.unshift(0)
dp=Array.new(N+1){Array.new(K+1,0)}
dp[0][0]=1
for i in 1..N
    for j in 0..K
        dp[i][j]=dp[i-1][(j-as[i] < 0 ? 0 : j-as[i])..j].inject(:+) % 1000000007
    end
end
p dp[N][K]
