from collections import * from functools import * from heapq import * from itertools import * import sys, math,random h,n = map(int,input().split()) H = [int(input()) for _ in range(n-1)] H += [h] H.sort(reverse=True) suffix = defaultdict(lambda:'th') suffix[1] = 'st' suffix[2] = 'nd' suffix[3] = 'rd' for i,_h in enumerate(H): if _h==h: print(f"{i+1}{suffix[i+1]}") exit()