#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<int> a(n);
  vector<int> b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  int pa = 0, pb = 0;
  long long ans = -1;
  while (k > -1) {
    if (pa >= n || pb >= m) {
      ans = -1;
      break;
    }
    if ((a[pa] + ta) > b[pb]) {
      pb++;
      continue;
    }
    if ((pb + k) >= m) {
      ans = -1;
      break;
    }
    ans = max(ans, b[pb + k] + tb);
    pa++;
    k--;
  }
  cout << ans;
}
