#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;

struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;
public:
    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1;
        while (n < sz) n *= 2;

        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for (int i=0; i<sz; ++i) node[i+n-1] = v[i];
        for (int i=n-2; i>=0; --i) node[i] = node[i*2+1] + node[i*2+2];
    }

    void eval(int k, int l, int r) {
        if (lazy[k] != 0) {
            node[k] += lazy[k];

            if (r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }

            lazy[k] = 0;
        }
    }

    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if (r < 0) r = n;

        eval(k, l, r);

        if (r <= a or b <= l) return;

        if (a <= l and r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if (r < 0) r = n;
        if (r <= a or b <= l) return 0;

        eval(k, l, r);
        if (a <= l and r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};

int main() {
    ll N, M, V, P;
    cin >> N >> M >> V >> P;
    vector<ll> A(N);
    rep(i, N) {
        cin >> A[i];
    }
    sort(A.rbegin(), A.rend());

    ll prev = 1e12, num = 0;
    rep(i, N) {
        if (prev == A[i]) {
            num++;
        }
        else if (prev > A[i]) {
            prev = A[i];
            if (num >= P) break;
            else num++;
        }
    }
    //
    // rep(i, N) {
    //     cout << A[i] << " ";
    // }
    // cout << endl;
    //cout << "num = " << num << endl;

    // rep(i, N) {
    //     cout << A[i] << " ";
    // }
    // cout << endl;

    LazySegmentTree lst(A);
    ll ans = num;

    for (int i=num; i<N; ++i) {
        // 右側を更新する
        //lst.add(i, min(N, i+V), M);

        if (A[i] + M < A[P-1]) continue;

        // 残りこれだけ
        ll left = V - (N-i);
        if (left < P) {
            //lst.add(0, left, M);
            // 取得する
            //ll tmp1 = lst.getsum(i, i+1);
            if (A[P-1] <= A[i] + M) {
                ans++;
            }
        }
        else  {

            // P-1個+Mする
            //lst.add(0, P, M);

            // iよりしたのやつら
            ll l1 = (N - i) * M;
            // (P-1)以下も全ぶっぱおk
            ll r1 = (P-1) * M;

            // [P, i)のところの現在の票数
            ll tmp = (A[i] + M) * (i - P + 1) - lst.getsum(P-1, i);

            //cout << A[i] << ": " << "// " << lst.getsum(P-1, i) << " " << tmp << ", " << l1 << ", " << r1 << ", " << M*V << endl;
            if (tmp >= 0 and tmp+l1+r1 >= M * V) {
                //cout << i << endl;
                ans++;
            }

            // ll left2 = left - (P-1);
            // ll tmp = (left2*M)/(N-(V-left2));
            // if ((left2*M)%(N-(V-left2)) > 0) {
            //     ll tmp2 = (left2*M)%(N-(V-left2));
            //     if (i - num < tmp2) {
            //         tmp++;
            //     }
            // }
            // //
            // // cout << (left2*M)%(N-(V-left2)) << ": " << tmp << ", " << left << ", " << left2 << ": : " << A[P-1] << endl;
            // // cout << A[i] << ", " << A[P-1] + tmp << ", " << left2 << endl;
            //
            // ll tmp1 = lst.getsum(i, i+1);
            // if (tmp + A[P-1] <= tmp1) {
            //     ans++;
            //     debug = true;
            // }

        }

        // 戻す
        // lst.add(i, min(N, i+V), -M);
        //
        // // 左側の範囲は
        // if (left < P) {
        //     lst.add(0, left, -M);
        // }
        // else {
        //     lst.add(0, P, -M);
        // }

        // if (debug) {
        //     cout << A[i] << ": " << i << endl;
        // }

    }
    cout << ans << endl;
}


Measured memory_bytes: 5888