S=input().split(' ') H=int(S[0]) N=int(S[1]) T=[] for i in range(N-1): T.append(input()) rank=0 for i in range(N-1): if(H < int(max(T))): rank=rank+1 T.remove(max(T)) if(i==N-2): print(rank+1,end='') if( (rank+1) % 10 == 1): print('st') if( (rank+1) % 10 == 2): print('nd') if( (rank+1) % 10 == 3): print('rd') else: print('th') else: print(rank+1,end='') if( (rank+1) % 10 ==1): print('st') break if( (rank+1) % 10 == 2): print('nd') break if( (rank+1) % 10 == 3): print('rd') break else: print('th') break