H, N = map(int, input().split()) h = [None] * N h[0] = H for i in range(1, N): h[i] = int(input()) h.sort(reverse=True) x = h.index(H) + 1 if x == 1: print('{}st'.format(x)) elif x == 2: print('{}nd'.format(x)) elif x == 3: print('{}rd'.format(x)) else: print('{}th'.format(x))