#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<long long int> a(n, 0);
  vector<long long int> b(m, 0);
  vector<long long int> fa(n, 0);
  vector<long long int> fb(m, 0);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    fa[i] = a[i] + ta;
  }
  for (long long int i = 0; i < m; i++) {
    cin >> b[i];
    fb[i] = b[i] + tb;
  }
  if (n <= k) {
    cout << "-1\n";
  } else {
    vector<long long int> s(n, 0);
    long long int ans = 0;
    vector<long long int>::iterator it;
    for (long long int i = 0; i < k + 1; i++) {
      it = upper_bound(b.begin(), b.end(), fa[i]);
      it--;
      if (*it == fa[i]) {
        it = it + (k - i);
        long long int in = it - b.begin();
        if (in >= b.size()) {
          cout << "-1\n";
          return 0;
        }
        s[i] = fb[in];
      } else {
        it++;
        it = it + (k - i);
        long long int in = it - b.begin();
        if (in >= b.size()) {
          cout << "-1\n";
          return 0;
        }
        s[i] = fb[in];
      }
    }
    ans = *max_element(s.begin(), s.end());
    cout << ans << "\n";
  }
  return 0;
}
