H,N = map(int,input().split()) H_list = [int(input()) for x in range(N - 1)] + [H] H_list.sort(reverse=True) num = H_list.index(H) + 1 digit1 = num % 10 tail = "th" if digit1 == 1: tail = "st" elif digit1 == 2: tail = "nd" elif digit1 == 3: tail = "rd" print("{}{}".format(num,tail))