#include <bits/stdc++.h>
using namespace std;
const long long inf = 4e18;
const long long N = 2e5 + 10;
void testCase() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<long long> a(n), b(m), c(m);
  for (long long &i : a) cin >> i, i += ta;
  for (long long i = 0; i < m; i++) cin >> b[i], c[i] = b[i] + tb;
  if (k >= min(n, m)) {
    cout << -1;
    return;
  }
  long long ans = -1;
  long long j = 0;
  for (long long i = 0; i < min(k + 1, n); i++) {
    long long rem = k - i;
    while (j < m and b[j] < a[i]) j++;
    if (m - j <= rem) {
      ans = -1;
      break;
    } else
      ans = max(ans, c[j + rem]);
  }
  cout << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  long long t_c = 1;
  while (t_c--) testCase();
}
