#!/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 str(ind)[-1] == '1': print('{0}st'.format(ind)) elif str(ind)[-1] == '2': print('{0}nd'.format(ind)) elif str(ind)[-1] == '3': print('{0}rd'.format(ind)) else: print('{0}th'.format(ind))