#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
long long a[N], b[N];
int main() {
  long long n, m, k, ta, tb;
  scanf("%lld %lld %lld %lld %lld", &n, &m, &ta, &tb, &k);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int j = 0; j < m; j++) scanf("%lld", &b[j]);
  if (k >= m || k >= n) {
    puts("-1");
    return 0;
  }
  long long ans = 0;
  for (int i = 0; i < n && i <= k; i++) {
    int j = lower_bound(b, b + m, a[i] + ta) - b;
    if (j + k - i < m)
      ans = max(ans, b[j + k - i] + tb);
    else {
      puts("-1");
      return 0;
    }
  }
  printf("%lld\n", ans);
}
