h, n = gets.split.map(&:to_i) a = [] (n-1).times do a << gets.to_i end ans = a.count { |i| i > h } + 1 case ans when 1 puts '1st' when 2 puts '2nd' when 3 puts '3rd' else puts "#{ans}th" end