import os MyPC = os.path.basename(__file__) != "Main.py" if MyPC: from icecream import ic ic.disable() else: def ic(*args): return None ic.enable() if MyPC else None def main(): h, n = map(int, input().split()) lh = [] for i in range(n-1): lh.append(int(input())) lh.append(h) lh2 = sorted(lh, reverse=True) if h == lh2[0]: print("1st") elif h == lh2[1]: print("2nd") elif h == lh2[2]: print("3rd") else: rank= lh2.index(h) print(f"{rank+1}th") if __name__ == "__main__": main()