#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, ta, tb, k, res = 0;
  cin >> n >> m >> ta >> tb >> k;
  if (k >= n || k >= m) {
    cout << -1;
    return 0;
  }
  vector<long long> a(n), b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < n && i <= k; i++) {
    long long search = a[i] + ta;
    long long l = -1;
    long long r = m;
    long long mid;
    while (l != r - 1) {
      mid = (l + r) / 2;
      if (b[mid] >= search)
        r = mid;
      else
        l = mid;
    }
    if (r + max(0LL, k - i) >= m) {
      cout << -1;
      return 0;
    }
    res = max(res, b[r + max(0LL, k - i)] + tb);
  }
  cout << res;
}
