h, N = map(int, input().split()) H = [int(input()) for _ in range(N-1)] H = sorted(H + [h])[::-1] x = str(H.index(h)+1) L = ['th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'] print(str(x) + L[int(x[-1])])