#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, t1, t2, k;
  cin >> n >> m >> t1 >> t2 >> k;
  vector<int> arr1(n);
  vector<int> arr2(m);
  for (int i = 0; i < n; i++) {
    cin >> arr1[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> arr2[i];
  }
  if (k >= min(n, m)) {
    cout << -1 << endl;
    return 0;
  }
  int res = 0;
  for (int i = 0; i <= k; i++) {
    int t = arr1[i] + t1;
    int posn = (int)(lower_bound(arr2.begin(), arr2.end(), t) - arr2.begin());
    posn += k - i;
    if (posn >= m) {
      cout << -1 << endl;
      return 0;
    }
    res = max(res, arr2[posn] + t2);
  }
  cout << res << endl;
}
