x,n=map(int,input().split()) h=[x]+[int(input()) for _ in range(n-1)] h.sort() a=n-h.index(x) if a%10==1: print(str(a)+'st') elif a%10==2: print(str(a)+'nd') elif a%10==3: print(str(a)+'rd') else: print(str(a)+'th')