H, N = gets.split.map(&:to_i) arr = [] (N-1).times do arr.push(gets.to_i) end str = (arr.push(H).sort{|a,b| b <=> a}.index(H) + 1).to_s case str[-1].to_i when 1 x="st" when 2 x="nd" when 3 x="rd" else x="th" end print str+x