#include <bits/stdc++.h>
using namespace std;
const long long INF2 = 3e18;
const long long INF = 1e9 + 7;
const long double EPS = 1e-6;
long double PI = 3.14159265358979323846264;
const long long MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)n; i++) {
    cin >> a[i];
  }
  vector<long long> b(m);
  for (long long i = 0; i < (long long)m; i++) {
    cin >> b[i];
  }
  long long ans = 0;
  for (int i = 0; i < min(n, k + 1); i++) {
    int j = lower_bound((b).begin(), (b).end(), a[i] + ta) - b.begin();
    int left = k - i;
    int last = j + left;
    if (last >= m) {
      cout << -1 << endl;
      return 0;
    }
    ans = max(ans, b[last] + tb);
  }
  if (k >= n || k >= m) {
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
}
