H,N = map(int,input().split(' ')) Hn = [int(input()) for i in range(N-1)] Hn.append(H) Hn.sort(reverse=True) for i in range(N): if Hn[i] != H: pass else: if i == 0: print('1st') elif i == 1: print('2nd') elif i == 2: print('3rd') elif i >= 3: print(i+1,'th')