from bisect import bisect NH, N = map(int, input().split()) heights = [] for i in range(1, N): heights.append(int(input())) heights.sort() i = bisect(heights, NH) rank = len(heights) - i + 1 if rank == 1: print('1st') elif rank == 2: print('2nd') elif rank == 3: print('3rd') else: print(rank + 'th')