h,n=map(int,input().split()) a=list(map(int,input().split())) num=[[h,0]] for i in range(n-1): num.append([a[i],1]) num.sort(key=lambda x: x[0],reverse=True) for i in range(n): if num[i][1]==1: ans=str(i+1) break if ans[-1]=="1": print(ans+"st") elif ans[-1]=="2": print(ans+"nd") elif ans[-1]=="3": print(ans+"rd") else: print(ans+"th")