l, n = map(int, input().split()) length = [int(input()) for _ in range(n-1)] ans = length + [l] ans.sort(reverse=True) ret = ans.index(l) + 1 r = ret % 10 if r == 1: print(f'{r}st') elif r == 2: print(f'{r}nd') elif r == 3: print(f'{r}rd') else: print(f'{r}th')