open System

let input1 = stdin.ReadLine().Split(' ')
let input2 = stdin.ReadLine().Split(' ')
//

//------------------------------------------------
let N = input1.[0] |> int
let M = input1.[1] |> int64
let V = input1.[2] |> int
let P = input1.[3] |> int
let A = input2 |> Array.map (fun x -> x |> int64) |> Array.take N

let solve =
    let a = A |> Array.sort
    let b = a.[N-P]
    let x = (a |> Array.findIndex (fun n -> n >= b)) - 1
    let s = 
        [0..x] |> List.map (fun i ->
        let m = a.[i] + M
        if m < b then 0
        else
            let r = M*((V-P-i)|>int64)   // P-1個とiを含む要素までは最大値の割当としてその残り
            let u = [i..x] |> List.map (fun j -> min M (m-a.[j+1])) |> List.sum
            if (r <= u) then 1 else 0
        ) |> List.sum
    s + (N-x-1)

solve |> printfn "%d"