#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const long long MOD = 1e9 + 7;
int N, M, K, Q, T;
pair<int, int> line[2 * MAXN];
int psum[2 * MAXN], ssum[2 * MAXN];
int main() {
  int i, j, ta, tb, x;
  scanf("%d%d%d%d%d", &N, &M, &ta, &tb, &K);
  for (i = 1; i <= N; ++i) {
    scanf("%d", &x);
    line[i] = {x + ta, 1};
  }
  for (i = 1; i <= M; ++i) {
    scanf("%d", &x);
    line[N + i] = {x, 2};
  }
  sort(line + 1, line + 1 + N + M);
  for (i = 1; i <= N + M + 1; ++i) {
    psum[i] = psum[i - 1] + (line[i].second == 1 ? 1 : 0);
  }
  for (i = N + M; i >= 0; --i) {
    ssum[i] = ssum[i + 1] + (line[i].second == 2 ? 1 : 0);
  }
  bool flag = false;
  int ans = -1;
  int mini = 0x3f3f3f3f;
  for (i = 1; i <= N + M; ++i) {
    mini = min(mini, psum[i - 1] + ssum[i]);
    if (line[i].second == 1 && !flag) flag = true;
    if (line[i].second == 2 && flag) {
      if (mini - ssum[i] <= K) {
        ans = line[i].first + tb;
      } else
        break;
    }
  }
  mini = min(mini, psum[N + M]);
  if (mini <= K)
    printf("-1");
  else
    printf("%d", ans);
  return 0;
}
