H,N = map(int,input().split()) H_list = [] for i in range(N-1): H_list.append(int(input())) H_list.append(H) H_list.sort() for i in range(N-1,-1,-1): if H == H_list[i]: number = str(N-i) break if number[-1] == "1": print(number,"st",sep = "") elif number[-1] == "2": print(number,"nd",sep = "") elif number[-1] == "3": print(number,"rd",sep = "") else: print(number,"th",sep = "")