#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long p = 1e9 + 7;
vector<long long> a, b;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a.push_back(x);
  }
  for (long long i = 0; i < m; i++) {
    long long x;
    cin >> x;
    b.push_back(x);
  }
  if (k >= n) {
    cout << "-1";
    return 0;
  }
  long long max_time = 0;
  for (long long i = 0; i <= min(k, n); i++) {
    long long cur = a[i] + ta;
    auto it = lower_bound(b.begin(), b.end(), cur);
    if (it == b.end()) {
      cout << "-1";
      return 0;
    }
    long long in = it - b.begin();
    in += k - i;
    if (in >= m) {
      cout << "-1";
      return 0;
    }
    max_time = max(max_time, b[in] + tb);
  }
  cout << max_time;
  return 0;
}
