H, N = map(int, input().split()) others = [int(input()) for _ in range(N-1)] all_heights = others + [H] sorted_heights = sorted(all_heights, reverse=True) rank = sorted_heights.index(H) + 1 last_digit = rank % 10 suffix = 'th' if last_digit == 1: suffix = 'st' elif last_digit == 2: suffix = 'nd' elif last_digit == 3: suffix = 'rd' print(f"{rank}{suffix}")