// Arup Guha
// Started 2/22/2020, finished 12/4/2020
// Solution to 2020 NAC Problem G: ICPC Camp
// Written during contest, but was incorrect. Debugged later.

import java.util.*;
import java.io.*;

public class icpccamp {

	public static int n;
	public static int p;
	public static int q;
	public static int maxS;
	public static int[] reg;
	public static TreeSet<pair> spe;
	
	public static void main(String[] args) throws Exception {
	
		// Get the basic input.
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		n = Integer.parseInt(tok.nextToken());
		p = Integer.parseInt(tok.nextToken());
		q = Integer.parseInt(tok.nextToken());
		maxS = Integer.parseInt(tok.nextToken());
		
		// Read in the classical problem difficulties and sort.
		reg = new int[p];
		for (int i=0; i<p; i++)
			reg[i] = Integer.parseInt(stdin.readLine().trim());
		Arrays.sort(reg);
		
		// Do the same for hte creative problems but store in a tree set sorted by value and broken by index to allow problems
		// with the same creativity.
		spe = new TreeSet<pair>();
		for (int i=0; i<q; i++) {
			int val = Integer.parseInt(stdin.readLine().trim());
			spe.add(new pair(val, i));
		}
		
		// Ta da!
		System.out.println(go());
	}
	
	public static int go() {
	
		// Just run a binary search
		int low = 0, high = 1000000001;
		while (low < high) {
			
			int mid = (low+high)/2;
			
			// We always start with a new Tree Set that was the original.
			TreeSet<pair> set = (TreeSet<pair>)spe.clone();
			
			// Update either low or high accordingly.
			if (canDo(mid,set))
				high = mid;
			else
				low = mid+1;
		}
		
		// This is what we want to return based on the spec.
		return low <= 1000000000 ? low : -1;
	}
	
	// See if maxD is achievable.
	public static boolean canDo(int maxD, TreeSet<pair> ts) {
	
		int match = 0;
		
		// Go through the regular problems from hardest to easiest.
		for (int i=p-1; i>=0; i--) {
			
			// Here are our requirements for the most we can get from the creative problem.
			int maxGet = maxS - reg[i];
			maxGet = Math.min(maxGet, reg[i]+maxD);
			
			// And the least.
			int minGet = reg[i] - maxD;
			
			// Nothing exists.
			if (minGet > maxGet) continue;
			
			// Get the largest thing smaller than this.
			pair tmp = new pair(maxGet+1,-1);
			pair x = ts.lower(tmp);
			
			// These don't count.
			if (x == null) continue;
			if (x.val < minGet) continue;
			
			// Match it!
			ts.remove(x);
			match++;
		}
		
		// We have enough if we have at least n.
		return match >= n;
	}
}

class pair implements Comparable<pair> {

	public int val;
	public int id;
	
	public pair(int v, int i) {
		val = v;
		id = i;
	}
	
	public int compareTo(pair other) {
		if (val != other.val)
			return val - other.val;
		return id - other.id;
	}
}