x,n=map(int,input().split()) lst=sorted(int(input()) for _ in range(n-1))[::-1] for i,j in enumerate(lst): if x>=j : if(i %10 <=3) :print(str(i+1)+["st","nd","rd"][i%10]);break else:print(str(i+1)+"th");break else: if(n+1 %10 <=3) :print(str(n)+["st","nd","rd"][n+1%10]) else:print(str(n)+"th")