myHeight = list(map(int, input().split())) heights = list(map(int, [input() for i in range(myHeight[1] - 1)])) heights.append(int(myHeight[0])) heights.sort() value = myHeight[1] - heights.index(myHeight[0]) if value % 10 == 1: print(str(value)+"st") elif value % 10 == 2: print(str(value)+"nd") elif value % 10 == 3: print(str(value)+"rd") else: print(str(value)+"th")