#include <bits/stdc++.h>
using namespace std;
vector<long long> a, b;
void masterstroke() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a.push_back(x);
  }
  for (long long j = 0; j < m; j++) {
    long long x;
    cin >> x;
    b.push_back(x);
  }
  if (k >= min(n, m)) {
    cout << -1;
    return;
  }
  sort(a.begin(), a.end());
  b.push_back(-1);
  sort(b.begin(), b.end());
  long long c = 0;
  long long un = 0;
  long long ti = 0;
  long long s = b.size();
  for (auto j : a) {
    long long tar = j + ta;
    long long lef = k - c;
    auto f = lower_bound(b.begin(), b.end(), tar);
    if (f == b.end()) {
      un = 1;
      break;
    }
    f--;
    long long za = f - b.begin();
    if (za + lef + 1 >= s) {
      un = 1;
      break;
    } else {
      ti = max(ti, b[za + lef + 1]);
    }
    c++;
    if (c == k + 1) {
      break;
    }
  }
  if (un) {
    cout << -1;
  } else {
    cout << ti + tb;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  for (long long i = 0; i < t; i++) masterstroke();
}
