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

arr = gets.split.map(&:to_i)

dp = Array.new(N+1){Array.new(K+1, 0)}
dp[0][0] = 1
# binding.pry
1.upto(N) do |i|
  (K+1).times do |j|
    (arr[i-1] + 1).times do |k|
      if j >= k
        # dp[i][j] i人目の時点でj個渡している総数
        dp[i][j] += dp[i-1][j-k]
      end
    end
  end
end
# p dp
p dp[N][K] % (10 ** 9 + 7)