h, n = map(int, input().split()) l = [int(input()) for _ in range(n-1)] l.append(h) l = sorted(l)[::-1] x = str(l.index(h) + 1) if x[-1] == '1': print(x + 'st') elif x[-1] == '2': print(x + 'nd') elif x[-1] == '3': print(x + 'rd') else: print(x + 'th')