import sys



read = sys.stdin.read

N, M, V, P, *A = list(map(int, read().split()))



A += [10 ** 10]

A.sort(reverse=True)

left = P

right = N + 1

# i番目の問題が採用される可能性があるか否や

e = tuple(enumerate(A))

while right - left > 1:

    mid = (right + left) // 2

    score = A[mid] + M

    if score < A[P]:

        right = mid

        continue

    s = M * (V - P)

    for idx, i in e[P:]:

        if mid == idx:

            continue

        if i + M <= score:

            s -= M

        else:

            s -= score - i



    if s <= 0:

        left = mid

    else:

        right = mid



print(left)

import sys

import numpy as np



read = sys.stdin.read

N, M, V, P, *A = list(map(int, read().split()))



A = np.array(A + [10 ** 10], np.int64)

A.sort()

A = A[::-1]

left = P

right = N + 1

# i番目の問題が採用される可能性があるか否や

while right - left > 1:

    mid = (right + left) // 2

    score = A[mid] + M

    if score < A[P]:

        right = mid

        continue



    s = np.minimum(score - A[P:], M)

    if np.sum(s) >= M * (V - (P - 1)):

        left = mid

    else:

        right = mid



print(left)

import sys

read = sys.stdin.read
N, M, V, P, *A = list(map(int, read().split()))
A += [10**10]
A.sort(reverse=True)
left = P
right = N + 1
# i番目の問題が採用される可能性があるか否や
e = tuple(enumerate(A))
while right - left > 1:
    mid = (right + left) // 2
    score = A[mid] + M
    if score < A[P]:
        right = mid
        continue
    s = M * (V - P)
    for idx, i in e[P:]:
        if mid == idx:
            continue
        if i + M <= score:
            s -= M
        else:
            s -= score - i
    if s <= 0:
        left = mid
    else:
        right = mid
print(left)

import sys
import numpy as np

read = sys.stdin.read
N, M, V, P, *A = list(map(int, read().split()))
A = np.array(A + [10**10], np.int64)
A.sort()
A = A[::-1]
left = P
right = N + 1
# i番目の問題が採用される可能性があるか否や
while right - left > 1:
    mid = (right + left) // 2
    score = A[mid] + M
    if score < A[P]:
        right = mid
        continue
    s = np.minimum(score - A[P:], M)
    if np.sum(s) >= M * (V - (P - 1)):
        left = mid
    else:
        right = mid
print(left)

+import numpy as np -A += [10**10] -A.sort(reverse=True) +A = np.array(A + [10**10], np.int64) +A.sort() +A = A[::-1] -e = tuple(enumerate(A)) -    s = M * (V - P) -    for idx, i in e[P:]: -        if mid == idx: -            continue -        if i + M <= score: -            s -= M -        else: -            s -= score - i -    if s <= 0: +    s = np.minimum(score - A[P:], M) +    if np.sum(s) >= M * (V - (P - 1)):