H, N = map(int, input().split()) Hs = [int(input()) for _ in range(N - 1)] Hs.append(H) Hs.sort(key=lambda x: - x) rnk = Hs.index(H) + 1 if rnk == 1: print('1st') elif rnk == 2: print('2nd') elif rnk == 3: print('3rd') else: print('{}th'.format(rnk))