MOD = 10 ** 9 + 7

N, K = gets.split.map(&:to_i)
As = gets.split.map(&:to_i).sort

#N = 100
#K = 10 ** 5
#As = N.times.map{rand(0..(K-1))}

dp = Array.new(K+1, 0)
rui = Array.new(K+2, 0)

dp[0] = 1
As.each do |a|
  q = 0
  (K+1).times do |j|
    rui[j+1] = q += dp[j]
    
    m = 0 > j-a ? 0 : j-a
    dp[j] = (q - rui[m]) % MOD    
  end
end

p dp[K]
