#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, ta, tb, k;
  long long int ans = 0;
  cin >> n >> m >> ta >> tb >> k;
  long long int a[n], b[m];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  if (k >= n || k >= m)
    cout << "-1\n";
  else {
    for (int i = 0; i <= k; i++) {
      if (a[i] + ta > b[m - k + i - 1]) {
        cout << "-1\n";
        return 0;
      }
      ans = max(ans, *(lower_bound(b, b + m, a[i] + ta) + k - i) + tb);
    }
    cout << ans << endl;
  }
}
