n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

m = 10 ** 9 + 7
d = Array.new(k+1, 0)
d[0] = 1
u = Array.new(k+1)

a.each do |e|
    (k+1).times do |i|
        d[i+1] += d[i] if i < k
        u[i] = d[i]
        u[i] -= d[i-e-1] if i > e
    end
    
    d, u = u, d
end

p d[k] % m