#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using ll = long long;
using ull = unsigned long long;
int n, m, ta, tb, k;
vector<int> a, b;
int ans = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> ta >> tb >> k;
  if ((k >= n) || (k >= m)) {
    cout << "-1";
    return 0;
  }
  a = vector<int>(n);
  b = vector<int>(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] += ta;
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int ai = 0, bi = 0;
  while ((bi < m) && (b[bi] < a[0])) bi++;
  int bi2 = bi;
  bi2 += k;
  if (bi2 >= m) {
    cout << "-1";
    return 0;
  }
  ans = b[bi2];
  while (ai < k) {
    ai++;
    bi2--;
    while ((bi2 < m) && (b[bi] < a[ai])) {
      bi++;
      bi2++;
    }
    if (bi2 >= m) {
      cout << "-1";
      return 0;
    }
    ans = max(ans, b[bi2]);
  }
  cout << (ll)ans + tb;
  return 0;
}
