#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1);
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int MAX = 2e5 + 10;
const long long mod = 1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
vector<long long> v[2];
long long ans;
int main() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long kk = k;
  for (int i = (0); i < (n); ++i) {
    long long x;
    cin >> x;
    v[0].push_back(x);
  }
  for (int i = (0); i < (m); ++i) {
    long long x;
    cin >> x;
    v[1].push_back(x);
  }
  ans = v[1][0] + tb;
  if (k >= min(n, m)) return cout << "-1", 0;
  for (int i = (0); i <= (k); ++i) {
    long long aa = v[0][i] + ta;
    long long pos =
        (long long)(lower_bound(v[1].begin(), v[1].end(), aa) - v[1].begin());
    pos += k - i;
    if (pos >= m) {
      return cout << "-1", 0;
    }
    ans = max(ans, v[1][pos] + tb);
  }
  cout << ans;
}
