import strutils, sequtils, algorithm let HN = readLine(stdin).split.map parseInt var arr = newSeqWith(0, 0) for i in 1 ..< HN[1]: arr.add readLine(stdin).parseInt arr.sort(cmp, Descending) for i in 0 .. arr.len: proc proc_A = echo i + 1, ["st", "nd", "rd", "th"][min(3, i)] if i == arr.len: proc_A() elif arr[i] < HN[0]: proc_A() else: continue break