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 == 1: print("1st") elif value == 2: print("2nd") elif value == 3: print("3rd") else: print(str(value)+"th")