#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  long long n, m, k;
  long long ta, tb;
  cin >> n >> m >> ta >> tb >> k;
  vector<long long> a(n), b(m);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (long long i = 0; i < m; ++i) {
    cin >> b[i];
  }
  if (n <= k or m <= k) {
    cout << -1 << endl;
    return;
  }
  long long ans = -1;
  for (long long i = 0; i <= k; ++i) {
    long long j = lower_bound(b.begin(), b.end(), a[i] + ta) - b.begin();
    long long l = j + (k - i);
    if (l >= m) {
      cout << -1 << endl;
      return;
    }
    chmax(ans, b[l] + tb);
  }
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
