H, N = map(int, input().split()) others = [int(input()) for _ in range(N-1)] heights = others + [H] heights.sort(reverse=True) rank = heights.index(H) + 1 if 11 <= (rank % 100) <= 13: suffix = "th" else: last_digit = rank % 10 if last_digit == 1: suffix = "st" elif last_digit == 2: suffix = "nd" elif last_digit == 3: suffix = "rd" else: suffix = "th" print(f"{rank}{suffix}")