list = [] Nao,N=[int(i) for i in input().split()] list.append(Nao) for i in range(N-1): list.append(int(input())) list.sort() #print(list) if list.index(Nao) == N-1: print("1st") elif list.index(Nao) == N-2: print("2nd") elif list.index(Nao) == N-3: print("3rd") else: Rank = str(N-list.index(Nao)) print( Rank + "th")