#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e5 + 4;
using namespace std;
int main() {
  long long n, m, ta, tb, k, ans = 0, max = 0;
  scanf("%lld", &n);
  scanf("%lld", &m);
  scanf("%lld", &ta);
  scanf("%lld", &tb);
  scanf("%lld", &k);
  long long a[n], b[m];
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    a[i] += ta;
  }
  for (int i = 0; i < m; i++) {
    scanf("%lld", &b[i]);
  }
  if (k >= min(n, m)) {
    printf("%d", -1);
    return 0;
  }
  for (int i = 0; i < k + 1; i++) {
    auto lb = lower_bound(b, b + m, a[i]);
    lb += k - i;
    if (lb == b + m) {
      printf("%d", -1);
      return 0;
    }
    ans = *lb;
    max = std ::max(ans, max);
  }
  printf("%lld", max + tb);
  return 0;
}
