#include <bits/stdc++.h>
const int INF = (int)2e9;
using namespace std;
template <class T>
istream &operator>>(istream &in, vector<T> &arr) {
  for (T &cnt : arr) {
    in >> cnt;
  }
  return in;
};
void solve() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<int> a(n), b(m);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> b[i];
  }
  long long ans = -1;
  if (k >= n) {
    cout << -1;
    exit(0);
  }
  for (int i = 0; i <= min(n - 1, k); ++i) {
    long long pos = lower_bound(b.begin(), b.end(), a[i] + ta) - b.begin();
    if (pos + (k - i) >= m) {
      cout << -1;
      exit(0);
    }
    ans = max(ans, b[pos + (k - i)] + tb);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}
