def solve(): line = input().split(' ') standard = int(line[0]) cnt = int(line[1]) - 1 li = [standard] for i in range(cnt): li.append(int(input())) li.sort(reverse=True) idx = 0 for i, item in enumerate(li): if (item == standard): idx = i break rank = idx + 1 if (rank % 10 == 1): print(str(rank) + 'st') elif (rank % 10 == 2): print(str(rank) + 'nd') elif (rank % 10 == 3): print(str(rank) + 'rd') else: print(str(rank) + 'th') solve()