h,n=map(int,input().split()) hx=[int(input()) for _ in '1'*(n-1)];hx.append(h) hx=sorted(hx,reverse=True) i=hx.index(h)+1 print(i,'th' if i==2 or i>3 else ['st','rd'][i==3],sep='')