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