from bisect import bisect_left h,n=map(int,input().split()) l=sorted(int(input()) for _ in range(n-1)) v=n-bisect_left(l,h) s="st" if v%10==1 else "nd" if v%10==2 else "rd" if v%10==3 else "th" print(str(v)+s)