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