open System


let No564 () =
    let IN = Console.ReadLine().Split(' ')
    let H = int <| IN.[0]
    let N = int <| IN.[1]

    let rec ranking (cnt:int) (rank:int) (H:int) (N:int) = 
        if cnt > 0 then
            let T = int <| Console.ReadLine()
            if T <= H && (rank - 1) >= 0 then
                ranking (cnt - 1) (rank - 1) H N
            else if T > N && (rank + 1) < N then
                ranking (cnt - 1) (rank + 1) H N
            else 
                ranking (cnt - 1) rank H N

        else
            rank + 1
    let r = ranking (N - 1) 1 H N
    printf "%A" r
    match r with
    | 1 -> printfn "st"
    | 2 -> printfn "nd"
    | 3 -> printfn "rd"
    | _ -> printfn "th"
 
    ()

No564 ()