h, n = map(int, input().split()) others = [int(input()) for _ in range(n-1)] all_heights = others + [h] all_heights.sort(reverse=True) rank = all_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}")