#yuki_564 h,n=map(int,raw_input().split()) l=[h] for i in xrange(n-1): l.append(int(raw_input())) print l l2=sorted(l,reverse=True) print l2 idx=l2.index(h)+1 if idx==11 or idx==12 or idx==13: print str(idx)+'th' elif idx%10==1: print str(idx)+'st' elif idx%10==2: print str(idx)+'nd' elif idx%10==3: print str(idx)+'rd' else: print str(idx)+'th'