h, n = map(int, input().split()) hl = [int(input()) for _ in range(n-1)] hl.append(h) hl = sorted(hl)[::-1] x = str(hl.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')