#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 100000 + 5;
long long AB[MAXN], BC[MAXN];
int main() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  for (int i = 0; i < n; i++) {
    cin >> AB[i];
    AB[i] += ta;
  }
  for (int i = 0; i < m; i++) {
    cin >> BC[i];
  }
  int ab = 0;
  int bc = 0;
  if (m <= k or n <= k) {
    cout << -1 << endl;
    return 0;
  }
  long long lastC = k;
  long long result = 0;
  while (ab < n && bc < m && k > 0) {
    if (AB[ab] <= BC[bc]) {
      if (lastC >= m) {
        cout << -1 << endl;
        return 0;
      } else {
        result = max(result, BC[lastC] + tb);
      }
      k--;
      ab++;
      lastC--;
    } else {
      bc++;
      lastC++;
    }
  }
  if (k == 0) {
    while (ab < n && bc < m) {
      if (AB[ab] > BC[bc]) {
        bc++;
        lastC++;
      } else {
        break;
      }
    }
  }
  if (lastC > m || ab == n || bc == m) {
    cout << -1 << endl;
    return 0;
  } else {
    result = max(result, BC[lastC] + tb);
  }
  cout << result << endl;
  return 0;
}
