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