#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9;
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll m, n, ta, tb, k, ans = -1;
  cin >> n >> m >> ta >> tb >> k;
  vector<ll> a(n), b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  if (min(m, n) <= k) {
    cout << -1;
    return 0;
  }
  int kek = 0;
  for (int i = 0; i <= k; i++) {
    ll time = a[i] + ta, now = -1;
    for (int j = kek; j <= m; j++) {
      if (b[j] >= time) {
        now = j;
        kek = j;
        break;
      }
    }
    if (now == -1) {
      cout << -1;
      return 0;
    }
    if (now + k - i >= m) {
      cout << -1;
      return 0;
    }
    if (b[now + k - i] > ans) ans = b[now + k - i];
  }
  cout << ans + tb;
}
