h, n = map(int, input().split()) l = [h] for i in range(n-1): l.append(int(input())) l = sorted(l)[::-1] if l.index(h) == 0: print('1st') elif l.index(h) == 1: print('2nd') elif l.index(h) == 2: print('3rd') else: print( str(l.index(h)+1) + 'th')