num = input().rstrip().split(" ") a = int(num[0]) b = int(num[1]) c = [a] for i in range(b - 1): d = input().rstrip() c.append(int(d)) c = sorted(c) e = str(b - c.index(a)) if int(e) % 10 == 1: print(e + "st") elif int(e) % 10 == 2: print(e + "nd") elif int(e) % 10 == 3: print(e + "rd") else: print(e + "th")