#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
void cp() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void solve() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long a[n], b[m];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) cin >> b[i];
  if (k >= n) {
    cout << -1 << endl;
    return;
  }
  long long arrival = a[0] + ta;
  long long idx = lower_bound(b, b + m, arrival) - b;
  if (idx >= m) {
    cout << -1 << endl;
    return;
  }
  long long time = b[idx] + tb;
  for (long long i = 0; i <= k; i++) {
    long long arrival_at_b = a[i] + ta;
    auto itr = lower_bound(b, b + m, arrival_at_b);
    long long idx = itr - b;
    if (idx >= m) {
      cout << -1 << endl;
      return;
    }
    long long pos = idx + (k - i);
    if (pos >= m) {
      cout << -1 << endl;
      return;
    }
    time = max(time, b[pos] + tb);
  }
  cout << time << endl;
}
int32_t main() {
  cp();
  long long t = 1;
  while (t--) solve();
  return 0;
}
