t = input().split() li = [] li.append(int(t[0])) for i in range(int(t[1]) - 1): li.append(int(input())) li.sort(reverse=True) for index, value in enumerate(li, start=1): if int(t[0]) == value: if index == 1: print(str(index) + "st") break elif index == 2: print(str(index) + "nd") break elif index == 3: print(str(index) + "rd") break else: print(str(index) + "th") break