#include <bits/stdc++.h>
using namespace std;
long long n, m, t, tt, k, a[200009], b[200009], mx;
int main() {
  cin >> n >> m >> t >> tt >> k;
  if (k >= n || k >= m) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] += t;
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (i > k) break;
    int s = lower_bound(b, b + m, a[i]) - b;
    if (m - s <= k - i) {
      cout << -1;
      return 0;
    } else {
      mx = max(mx, b[s + (k - i)]);
    }
  }
  cout << mx + tt << endl;
}
