h, n = map(int, input().split()) others = [int(input()) for _ in range(n-1)] heights = [h] + others sorted_heights = sorted(heights, reverse=True) rank = sorted_heights.index(h) + 1 def get_suffix(r): if 11 <= (r % 100) <= 13: return 'th' last = r % 10 if last == 1: return 'st' elif last == 2: return 'nd' elif last == 3: return 'rd' else: return 'th' suffix = get_suffix(rank) print(f"{rank}{suffix}")