hight = [] H,N = map(int,input().split()) for i in range(N-1): hight.append(int(input())) hight.append(H) hight.sort() hight.reverse() ans = str(hight.index(H)+1) if ans[-1]=="1": print(ans+"st") elif ans[-1]=="2": print(ans+"nd") elif ans[-1]=="3": print(ans+"rd") else: print(ans+"th")