un = input().split() nam = int(un[0]) ans = 1 for i in range(int(un[1]) - 1): unnn = int(input()) if unnn > nam: ans += 1 if ans == 1: print("1st") elif ans == 2: print("2nd") elif ans == 3: print("3rd") else: print(str(ans)+"th")