nama,N=list(map(int,input().split(" "))) H=[] for i in range(N-1): H.append(int(input())) H.append(nama) rank=str(list(reversed(sorted(H))).index(nama)+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")