h,n=map(int,input().split()) c=1 for _ in range(n-1): if int(input())>h:c+=1 print((('1st','2nd','3rd')[c-1],str(c)+'th')[c>3])