Scanf.scanf "%d %d %d %d" (fun n m v p ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    Array.sort (fun a b -> compare b a) a;

    let border = a.(p - 1) in

    let bordersum =
        let rec loop i acc =
            if i = n then acc else
                loop (i + 1) (acc + border - a.(i))
        in
        loop p 0
    in

    let rec loop i acc =
        if i = n then acc else
            if a.(i) + m < border then acc else
                let nb = bordersum - (border - a.(i)) in
                if nb + (a.(i) + m - border) * (n - p) <= (v - p) * m then acc
                else loop (i + 1) (acc + 1)
    in
    loop p p |> Printf.printf "%d\n"
)