#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long MOD = 1e9 + 7;
inline long long add(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline long long mul(long long x, long long y) { return (x * 1ll * y) % mod; }
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const long long N = 2e5 + 5;
inline void io() {}
signed main() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<long long> a(n), arr(m);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) cin >> arr[i];
  if (k >= n) return cout << -1, 0;
  long long ans = 0;
  for (long long i = 0; i < k + 1; i++) {
    long long x = a[i] + ta;
    auto it = lower_bound(arr.begin(), arr.end(), x);
    if (it == arr.end()) {
      cout << -1;
      return 0;
    }
    long long pos = it - arr.begin();
    pos += k - i;
    if (pos >= m) {
      cout << -1;
      return 0;
    }
    ans = max(ans, arr[pos] + tb);
  }
  cout << ans;
}
