m,n=map(int,input().split()) f=lambda:int(input()) h=[f() for i in range(n-1)] h+=[m] srt=sorted(h)[::-1] print(srt) r=srt.index(m)+1 bi='st' if r%10==1 else 'nd' if r%10==2 else 'rd' if r%10==3 else 'th' print(str(r)+bi)