a,b = map(int,input().split()) l = [a] + [int(input()) for _ in range(b - 1)] l = sorted(l)[::-1] for i,p in enumerate(l): if p == a: if i < 3: print(["1st","2nd","3rd"][i]) else: print(str(i+1)+'th') exit()