#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int n, m, Ta, Tb, k, A[maxn], B[maxn], ans = 0, up = 0;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> Ta >> Tb >> k;
  for (int i = 0; i < n; i++) cin >> A[i], A[i] += Ta;
  for (int i = 0; i < m; i++) cin >> B[i];
  if (k >= n) {
    cout << -1;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (i <= k) {
      up = lower_bound(B, B + m, A[i]) - B;
      if (up + abs(k - i) >= m) {
        cout << -1 << "\n";
        return 0;
      }
      ans = max(ans, B[up + abs(k - i)] + Tb);
    }
  }
  cout << ans << "\n";
  return 0;
}
