h, n = map(int, input().split()) d = [int(input()) for _ in range(n-1)] d.append(h) d.sort(reverse=True) r = d.index(h)+1 if str(r)[-1] == "1": print(f"{r}st") elif str(r)[-1] == "2": print(f"{r}nd") elif str(r)[-1] == "3": print(f"{r}rd") else: print(f"{r}th")