# coding: utf-8 # Your code here! list_h = [] h, n = map(int, input().rstrip().split()) list_h.append(h) for i in range(n-1): list_h.append(int(input())) sort_h = sorted(list_h, reverse=True) rank = str(sort_h.index(h) + 1) if rank[-1] == '1': print(rank + 'st') elif rank[-1] == '2': print(rank + 'nd') elif rank[-1] == '3': print(rank + 'rd') else: print(rank + 'th')