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