import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 10^^9 + 7;
immutable long INF = 1L << 59;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1] + 1;
    auto K = s[4];
    auto Ta = s[2];
    auto Tb = s[3];
    auto A = readln.split.map!(to!long).array;
    auto B = readln.split.map!(to!long).array ~ INF;

    if (N <= K || M - 1 <= K) {
        writeln(-1);
        return;
    }

    auto opt = new int[](N);
    long ans = 0;

    for (int i = 0, j = 0; j < M; ++j) {
        while (i < N && A[i] + Ta <= B[j]) opt[i++] = j;
    }

    foreach (i; 0..N) {
        if (i > K) break;
        int j = opt[i] + K - i;
        if (j > M) {
            ans = INF;
            break;
        }
        ans = max(ans, B[j] + Tb);
    }

    writeln((ans >= INF ? -1 : ans));
}