#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, t1, t2, k;
  cin >> n >> m >> t1 >> t2 >> k;
  vector<long long int> ar1(n);
  for (long long int i = 0; i < n; i++) {
    cin >> ar1[i];
  }
  vector<long long int> ar2(m);
  for (long long int i = 0; i < m; i++) {
    cin >> ar2[i];
  }
  if (n <= k || m <= k) {
    cout << "-1\n";
    return 0;
  }
  long long int ans = 0;
  long long int x = 0, y = -1;
  for (long long int i = k, j = m - 1; i >= 0; i--) {
    x = ar1[i] + t1;
    while (j >= 0 && x <= ar2[j]) {
      y = j, j--;
    }
    if (y == -1) {
      cout << "-1\n";
      return 0;
    }
    if (y + k - i > m - 1) {
      cout << "-1\n";
      return 0;
    }
    ans = max(ans, ar2[y + k - i] + t2);
  }
  cout << ans << "\n";
  return 0;
}
