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 if str(i)[-1]=='1': m='st' elif str(i)[-1]=='2': m='nd' elif str(i)[-1]=='3': m='rd' else:m='th' print(i,m,sep='')