#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<int> a(n), b(m);
  int j = m - 1, tmax = -1;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = min(k, n - 1); i >= 0; i--) {
    for (; j >= 0; j--) {
      if (b[j] < a[i] + ta) {
        ;
        j++;
        break;
      }
    }
    if (j < 0) j = 0;
    if (j > m - 1) {
      tmax = -1;
      break;
    }
    if ((j + k - i) < m) {
      tmax = max(tmax, b[j + (k - i)] + tb);
    } else {
      tmax = -1;
      break;
    }
  }
  if (k >= n || k >= m) tmax = -1;
  cout << tmax << endl;
  return 0;
}
