def ascan; gets.split.map(&:to_i);end h,n = ascan l = [] (n-1).times{ l << gets.to_i } l << h l.sort!.reverse! r = l.index(h)+1 print r if r%10 == 1 puts "st" elsif r%10 == 2 puts "nd" elsif r%10 == 3 puts "rd" else puts "th" end