#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 2;
long long MOD = 1e9 + 7;
long long a[200005];
long long b[200005];
vector<long long> s;
int main() {
  long long n, m, t1, t2, k;
  cin >> n >> m >> t1 >> t2 >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    s.push_back(b[i]);
  }
  if (k >= n || k >= m) {
    cout << -1;
    return 0;
  }
  long long ans = 0;
  int sum = 0;
  for (int i = k; i >= 0; i--, sum++) {
    long long time = a[i] + t1;
    if (time > b[m - 1]) {
      cout << -1;
      return 0;
    }
    int index = (lower_bound(s.begin(), s.end(), time) - s.begin());
    index += sum;
    if (index >= m) {
      cout << -1;
      return 0;
    }
    ans = max(ans, b[index] + t2);
  }
  cout << ans;
}
