H, N = map(int, input().split()) h = [int(input()) for i in range(N-1)] h.append(H) h.sort() h.reverse() rank = (h.index(H) + 1) ranking = str(rank) if rank % 10 == 1: print(ranking + 'st') elif rank % 10 == 2: print(ranking + 'nd') elif rank % 10 == 3: print(ranking + 'rd') else: print(ranking + 'th')