let () = Scanf.scanf "%d %d %d %d\n" @@ fun n m v p ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  Array.sort (fun a a' -> compare a' a) as_;
  Printf.printf "%d\n" @@
  snd @@
  Array.fold_left (fun ((oblig, c), n) a ->
    (oblig + a, c + 1),
    n
    + if
        as_.(p - 1) <= a ||
        as_.(p - 1) <= a + m &&
        oblig <= (n - v) * m + a * c
      then 1
      else 0)
  ((Array.fold_left ( - ) 0 (Array.sub as_ 0 (p - 1)), 0), 0) as_
