n, m, v, P = gets.split.map(&:to_i)

tasks = gets.split.map(&:to_i).sort
# p tasks
# sub_tasks = tasks[0, v]
sub_max = tasks[v - 1]
res = 0
target_candidates = tasks[[n - P, v].max..-1]
target_num = target_candidates.find { |i| i > sub_max }
tasks.each do |i|
  # puts i if (i + m) >= tasks[target]
  if target_num.nil?
    res += 1 if i == sub_max
  else
    res += 1 if (i + m) >= target_num
  end
end
puts [res, P].max