H, N = gets.split.map(&:to_i) arr = [[-H, -1]] (N-1).times do |i| h = gets.to_i arr.push([-h, i]) end arr.sort! N.times do |i| if arr[i][1] == -1 ans = i+1 print(ans) puts (case ans%10 when 1 "st" when 2 "nd" when 3 "rd" else "th" end) exit end end