h, n = map(int, input().split()) r = str(sorted([int(input()) for _ in range(n-1)] + [h], reverse=True).index(h) + 1) th = ["st", "nd", "rd"] + ["th"] * (n - 3) print(r + th[int(r)-1])