H, N = map(int, input().split()) L = [H] for _ in range(N-1): L += [int(input())] L = sorted(L)[::-1] X = str(L.index(H)+1) Y = X[-1] if Y == '1': Z = 'st' elif Y == '2': Z = 'nd' elif Y == '3': Z = 'rd' else: Z = 'th' print(X + Z)