#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
long long n, m;
vector<long long> a;
vector<long long> b;
long long k, ta, tb;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> ta >> tb >> k;
  for (int i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  for (int i = 0; i < m; i++) {
    long long tmp;
    cin >> tmp;
    b.push_back(tmp);
  }
  for (int i = 0; i < 2 * MAXN; i++) b.push_back((long long)1e15);
  long long ans = 0;
  for (int i = 0; i < min(k + 1, (long long)a.size()); i++) {
    long long netim = a[i] + ta;
    auto it = lower_bound(b.begin(), b.end(), netim);
    it += (k - i);
    ans = max(ans, *it + tb);
  }
  if (a.size() <= k) ans = 1e15;
  if (ans > 1e12)
    cout << -1 << endl;
  else
    cout << ans << endl;
}
