H,N=map(int,input().split()) X=[0]*N X[0]=H for _ in range(1,N): X[_]=int(input()) X.sort(reverse=True) for i in range(N): if H==X[i]: if i==0: print("1st");exit() elif i==1: print("2nd");exit() elif i==2: print("3rd");exit() else: print(str(i+1)+"th");exit()