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 str(x)[-1] == '1': print('{}st'.format(x)) elif str(x)[-1] == '2': print('{}nd'.format(x)) elif str(x)[-1] == '3': print('{}rd'.format(x)) else: print('{}th'.format(x))