#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N, M, T1, T2, K;
int A[200100], B[200100];
int firstB[200100];
void done() {
  printf("-1\n");
  exit(0);
}
int main() {
  scanf("%d%d%d%d%d", &N, &M, &T1, &T2, &K);
  for (int i = 0; i < N; i++) scanf("%d", &A[i]);
  for (int i = 0; i < M; i++) scanf("%d", &B[i]);
  int ptrB = 0;
  for (int i = 0; i < N; i++) {
    while (ptrB < M && A[i] + T1 > B[ptrB]) {
      ptrB++;
    }
    firstB[i] = ptrB;
  }
  for (int i = 0; i < N; i++)
    ;
  if (K >= N || K >= M) done();
  int ans = -1;
  for (int i = 0; i <= min(K, N - 1); i++) {
    int left = K - i;
    int fb = firstB[i];
    if (fb + left >= M) done();
    ans = max(ans, B[fb + left] + T2);
  }
  printf("%d\n", ans);
}
