#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 5;
long long a[maxn], b[maxn];
long long n, m, ta, tb, k;
int main() {
  while (cin >> n >> m >> ta >> tb >> k) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    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" << endl;
      return 0;
    } else {
      long long ans = 0;
      for (int i = 0; i <= k; i++) {
        int tmp = a[i] + ta;
        int pos = lower_bound(b, b + m, tmp) - b;
        pos += (k - i);
        if (pos >= m) {
          cout << "-1" << endl;
          return 0;
        }
        ans = max(ans, b[pos] + tb);
      }
      cout << ans << endl;
    }
  }
  return 0;
}
