b=[] a=[int(i) for i in input().split()] for i in range(a[1]-1): b.append(int(input())) b.append(a[0]) b.sort() c=len(b)-b.index(a[0]) if c==1: print("1st") elif c==2: print("2nd") elif c==3: print("3rd") else: print(str(c)+"th")