H,N = map(int, input().split()) Hs = [-H] + [-int(input()) for _ in range(N-1)] rank = sorted(Hs).index(-H) + 1 th = 'th' if rank % 10 == 1: th = 'st' elif rank % 10 == 2: th = 'nd' elif rank % 10 == 3: th = 'rd' print(str(rank) + th)