#include <bits/stdc++.h>
using namespace std;
void pv(std::vector<int> v) {
  for (int i = 0; i < v.size(); ++i) {
    cout << v[i] << " ";
  }
  cout << "" << endl;
}
void pa(int a[], int n, int p) {
  for (int i = p; i < n + p; ++i) {
    cout << a[i] << " ";
  }
  cout << "" << endl;
}
const double pi = 3.141592653589793238;
const int inf = INT_MAX;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, ta, tb, k, ans1 = 0, ans2 = -1, temp1, temp2, t1;
  cin >> n >> m >> ta >> tb >> k;
  long long int q1[n + 1], q2[m + 1];
  for (int i = 1; i <= n; i += 1) cin >> q1[i];
  for (int i = 1; i <= m; i += 1) cin >> q2[i];
  if (n <= k || m <= k) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i <= k + 1; i += 1) {
    t1 = lower_bound(q2 + 1, q2 + m + 1, q1[i] + ta) - q2;
    temp1 = k - i + 1;
    if (t1 + temp1 <= m)
      ans1 = max(ans1, q2[t1 + temp1] + tb);
    else {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans1 << endl;
  ;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
