#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long a[n + 1];
  long long b[m + 1];
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < m + 1; i++) {
    cin >> b[i];
  }
  long long maxx = -1;
  if (k >= n || k >= m) {
    cout << "-1";
    return;
  } else {
    for (int i = 0; i <= k; i++) {
      long long rem = k - i;
      long long arrival = a[i + 1] + ta;
      long long x = lower_bound(b + 1, b + m + 1, arrival) - b;
      if ((m - x + 1) <= rem || x > m) {
        cout << "-1";
        return;
      } else {
        long long ans = b[x + rem] + tb;
        maxx = max(maxx, ans);
      }
    }
    cout << maxx;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1, n;
  while (t--) {
    solve();
  }
}
