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 ones = rank % 10 if ones == 1: print(rank + 'st') elif ones == 2: print(rank + 'nd') elif ones == 3: print(rank + 'rd') else: print(rank + 'th')