#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<long long int> a(n);
  vector<long long int> b(m);
  if (k >= m or k >= n) {
    cout << "-1\n";
    return 0;
  }
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < m; i++) cin >> b[i];
  long long int ans = 0;
  for (long long int x = 0; x <= k; x++) {
    long long int pos =
        (lower_bound(b.begin(), b.end(), a[x] + ta) - b.begin());
    pos = pos + (k - x);
    if (pos >= m) {
      cout << "-1\n";
      return 0;
    }
    ans = max(ans, b[pos] + tb);
  }
  cout << ans << "\n";
  return 0;
}
