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) Rank = str(N-list.index(Nao)) if (N-list.index(Nao)) % 10 == 1: print(Rank + "st") elif (N-list.index(Nao)) % 10==2: print(Rank + "nd") elif (N-list.index(Nao)) % 10==3: print(Rank + "rd") else: print( Rank + "th")