n = gets.to_i k = gets.to_i scores = [k] puts 1 (n-1).times do |i| a = gets.to_i scores.each_with_index do |s, i| if s < a scores.insert(i, a) break end end puts scores.index(k) + 1 end