#!/usr/bin/env python hn = [int(x) for x in input().split()] hlist = [hn[0]] for i in range(hn[1]-1): hlist.append(int(input())) hlist.sort(reverse=True) ind = hlist.index(hn[0]) + 1 if ind == 1: print('1st') elif ind == 2: print('2nd') elif ind == 3: print('3rd') else: print('{0}th'.format(ind))