#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5 + 3;
int a[MX], b[MX];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  if (k >= n || k >= m) return !(cout << -1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int ans = 0;
  for (int i = 0; i <= k; i++) {
    int lft = k - i;
    int j = lower_bound(b, b + m, a[i] + ta) - b;
    if (j + lft >= m) return !(cout << -1);
    ans = max(ans, b[j + lft] + tb);
  }
  cout << ans;
}
