#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int a[200009], b[200009], ans;
int main() {
  int n, m, ta, tb, k;
  scanf("%d%d%d%d%d", &n, &m, &ta, &tb, &k);
  if (min(n, m) <= k) return puts("-1") * 0;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= m; i++) scanf("%d", b + i);
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  for (int i = 0; i <= k; i++) {
    int pos = lower_bound(b + 1, b + m + 1, a[i + 1] + ta) - b;
    pos += k - i;
    if (pos > m) return puts("-1") * 0;
    umax(ans, b[pos] + tb);
  }
  printf("%d\n", ans);
  return 0;
}
