#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long inf = 1e9;
double eps = 1e-8;
double pi = acos(-1);
ifstream in("input.txt");
ofstream out("output.txt");
int main() {
  int n, m;
  cin >> n >> m;
  long long ta, tb, k;
  cin >> ta >> tb >> k;
  vector<long long> a;
  vector<long long> b;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }
  for (int j = 0; j < m; j++) {
    int t;
    cin >> t;
    b.push_back(t);
  }
  vector<int> fstk(n, m);
  int p = 0;
  for (int i = 0; i < m; i++) {
    while (p < n && a[p] + ta <= b[i]) {
      fstk[p++] = i;
    }
    if (p == n) break;
  }
  if (p <= k) {
    cout << "-1";
    return 0;
  }
  long long cans = 0;
  for (int i = 0; i <= k; i++) {
    int t = fstk[i];
    if (t + k - i >= m) {
      cout << "-1";
      return 0;
    } else {
      cans = max(cans, b[t + k - i] + tb);
    }
  }
  cout << cans;
  return 0;
}
