print((function (h, n) local r,t = "",1 for _=1,n-1 do if h < io.stdin:read("*n") then t = t+1 end end r,t = tostring(t),t%10 return r .. (t==1 and "st" or t==2 and "nd" or t==3 and "rd" or "th") end)(io.stdin:read("*n"), io.stdin:read("*n")))