#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b, long long int m) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long int a[300009];
  vector<long long int> b;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] += ta;
  }
  for (long long int i = 0; i < m; i++) {
    long long int x;
    cin >> x;
    b.push_back(x);
  }
  sort((b).begin(), (b).end());
  long long int ans = -1;
  if (k >= n || k >= m) {
    cout << -1 << endl;
    return 0;
  }
  for (long long int i = 0; i < k + 1; i++) {
    long long int val = a[i];
    auto it = lower_bound(b.begin(), b.end(), val);
    long long int ind = it - b.begin();
    ind += (k - i);
    if (ind >= m) {
      cout << -1 << endl;
      return 0;
    }
    long long int value = b[ind] + tb;
    ans = max(ans, value);
  }
  cout << ans << endl;
}
