#include <bits/stdc++.h>
double PI = 2 * acos(0.0);
int dx[] = {0, 0, 1, -1, 2, 2, -2, -2, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, 1, -1, 1, -1, 2, 2, -2, -2};
using namespace std;
long long int SET(long long int NUM, long long int POS) {
  return NUM | (1 << POS);
}
bool isOn(long long int NUM, long long int POS) {
  return (bool)(NUM & (1 << POS));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int tcase = 1;
  for (long long int test = 1; test <= tcase; test++) {
    vector<long long int> Va, Vb;
    long long int n, m, ta, tb, k;
    cin >> n >> m >> ta >> tb >> k;
    for (long long int i = 0; i < n; i++) {
      long long int a;
      cin >> a;
      Va.push_back(a);
    }
    for (long long int i = 0; i < m; i++) {
      long long int a;
      cin >> a;
      Vb.push_back(a);
    }
    if (k >= min(n, m)) {
      cout << "-1\n";
      continue;
    }
    long long int ans = 0;
    long long int jabo = min(n, k + 1);
    for (long long int i = 0; i < jabo; i++) {
      long long int baki = k - i;
      long long int pos =
          lower_bound(Vb.begin(), Vb.end(), Va[i] + ta) - Vb.begin();
      pos += baki;
      ans = max(ans, pos);
    }
    if (ans >= m) {
      cout << "-1\n";
    } else {
      cout << Vb[ans] + tb << "\n";
    }
  }
}
