H, N = map(int, input().split()) L = [int(input()) for _ in range(N-1)] L = sorted(L + [H])[::-1] X = L.index(H)+1 D = ['th', 'st', 'nd', 'rd'] + ['th']*6 print(str(X) + D[X%10])