h, n = map(int, input().split()) hights = [] for i in range(n-1): hights.append(int(input())) hights.sort(reverse=True) number = 1 for hight in hights: if h > hight: break number += 1 if number == 1: print(str(number) + 'st') elif number == 2: print(str(number) + 'nd') elif number == 3: print(str(number) + 'rd') else: print(str(number) + 'th')