#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, n, m, k = 0, T, x[200010], y[200010], head[200010],
                            maxx = -0x3f3f3f3f;
struct node {
  long long u, v, Next;
} t[2 * 200010];
void add(long long u, long long v) {
  t[++k].v = v;
  t[k].Next = head[u];
  head[u] = k;
}
int main() {
  scanf("%d%d%d%d%d", &n, &m, &a, &b, &k);
  long long ans = 0;
  for (long long i = 1; i <= n; i++) scanf("%d", &x[i]);
  for (long long i = 1; i <= m; i++) scanf("%d", &y[i]);
  if (k >= n || k >= m) {
    cout << "-1";
    return 0;
  }
  for (long long i = 0; i <= k; i++) {
    long long tmp = x[i + 1] + a;
    long long p = lower_bound(y + 1, y + 1 + m, tmp) - y;
    if (p + k - i > m) {
      cout << "-1";
      return 0;
    } else
      ans = max(ans, y[p + k - i] + b);
  }
  cout << ans;
}
