import sys

from bisect import bisect_right, bisect_left

input = sys.stdin.readline

n, m, v, p = [int(x) for x in input().strip().split()]

araw = sorted([int(x) for x in input().strip().split()])

a = list(reversed(araw))



def f(x, n, m, v, p, a, araw):

    c = p - (n - bisect_right(araw, a[x-1]+m)) - 1

    if c < 0:

        return False

    vote = m * (v - 1)

    a[x-1] += m

    thr = a[x-1]

    for i, aa in enumerate(a, start=1):

        if vote <= 0:

            break

        if i == x:

            continue

        if aa > thr:

            a[i-1] += m

            vote -= m

        elif aa == thr:

            if c:

                a[i-1] += m

                vote -= m

                c -= 1

        elif thr - aa < m:

            if c:

                a[i-1] += m

                vote -= m

                c -= 1

            else:

                v_ = min(vote, thr - aa, m)

                a[i-1] += v_

                vote -= v_

        else:

            a[i-1] += m

            vote -= m

    return vote <= 0



x = 0

l = 1

r = n + 1

while l < r:

    x = (l + r) // 2

    if f(x, n, m, v, p, a[:], araw):

        l = x + 1

    else:

        r = x

print((l-1))
import sys

from bisect import bisect_right, bisect_left

input = sys.stdin.readline

n, m, v, p = [int(x) for x in input().strip().split()]

araw = sorted([int(x) for x in input().strip().split()])

a = list(reversed(araw))



def f(x, n, m, v, p, a, araw):

    c = p - (n - bisect_right(araw, a[x-1]+m)) - 1

    if c < 0:

        return False

    vote = m * (v - 1)

    thr = a[x-1] + m

    for i, aa in enumerate(a, start=1):

        if vote <= 0:

            break

        if i == x:

            continue

        if aa > thr:

            vote -= m

        elif aa == thr:

            if c:

                vote -= m

                c -= 1

        elif thr - aa < m:

            if c:

                vote -= m

                c -= 1

            else:

                v_ = min(vote, thr - aa, m)

                vote -= v_

        else:

            vote -= m

    return vote <= 0



x = 0

l = 1

r = n + 1

while l < r:

    x = (l + r) // 2

    if f(x, n, m, v, p, a[:], araw):

        l = x + 1

    else:

        r = x

print((l-1))
import sys
from bisect import bisect_right, bisect_left

input = sys.stdin.readline
n, m, v, p = [int(x) for x in input().strip().split()]
araw = sorted([int(x) for x in input().strip().split()])
a = list(reversed(araw))


def f(x, n, m, v, p, a, araw):
    c = p - (n - bisect_right(araw, a[x - 1] + m)) - 1
    if c < 0:
        return False
    vote = m * (v - 1)
    a[x - 1] += m
    thr = a[x - 1]
    for i, aa in enumerate(a, start=1):
        if vote <= 0:
            break
        if i == x:
            continue
        if aa > thr:
            a[i - 1] += m
            vote -= m
        elif aa == thr:
            if c:
                a[i - 1] += m
                vote -= m
                c -= 1
        elif thr - aa < m:
            if c:
                a[i - 1] += m
                vote -= m
                c -= 1
            else:
                v_ = min(vote, thr - aa, m)
                a[i - 1] += v_
                vote -= v_
        else:
            a[i - 1] += m
            vote -= m
    return vote <= 0


x = 0
l = 1
r = n + 1
while l < r:
    x = (l + r) // 2
    if f(x, n, m, v, p, a[:], araw):
        l = x + 1
    else:
        r = x
print((l - 1))

import sys
from bisect import bisect_right, bisect_left

input = sys.stdin.readline
n, m, v, p = [int(x) for x in input().strip().split()]
araw = sorted([int(x) for x in input().strip().split()])
a = list(reversed(araw))


def f(x, n, m, v, p, a, araw):
    c = p - (n - bisect_right(araw, a[x - 1] + m)) - 1
    if c < 0:
        return False
    vote = m * (v - 1)
    thr = a[x - 1] + m
    for i, aa in enumerate(a, start=1):
        if vote <= 0:
            break
        if i == x:
            continue
        if aa > thr:
            vote -= m
        elif aa == thr:
            if c:
                vote -= m
                c -= 1
        elif thr - aa < m:
            if c:
                vote -= m
                c -= 1
            else:
                v_ = min(vote, thr - aa, m)
                vote -= v_
        else:
            vote -= m
    return vote <= 0


x = 0
l = 1
r = n + 1
while l < r:
    x = (l + r) // 2
    if f(x, n, m, v, p, a[:], araw):
        l = x + 1
    else:
        r = x
print((l - 1))

-    a[x - 1] += m -    thr = a[x - 1] +    thr = a[x - 1] + m -            a[i - 1] += m -                a[i - 1] += m -                a[i - 1] += m -                a[i - 1] += v_ -            a[i - 1] += m