def Main(): from bisect import bisect h,n=map(int,input().split()) a=[int(input())for _ in range(n-1)] a.sort() ans=n-bisect(a,h) print(ans,end="") if ans%10==1: print("st") elif ans%10==2: print("nd") elif ans%10==3: print("rd") else: print("th") Main()