def max(a, b)
  a > b ? a : b
end

MOD = 10 ** 9 + 7

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

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

dp[0][0] = 1
N.times do |i|
  a = As[i]
  q = 0
  (K+1).times do |j|
    q += dp[i][j]
    rui[j+1] = q
    
    
    m = max(0, j+1-(a+1))
    dp[i+1][j] = (rui[j+1] - rui[m]) % MOD    
  end
end

p dp[N][K]
