#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ifstream in("");
  ofstream out("");
  clock_t begin = clock();
  long long n, m, t1, t2, k;
  cin >> n >> m >> t1 >> t2 >> k;
  long long a[200005], b[200005];
  long long res = 0;
  for (int i = (0); i < (n); ++i) cin >> a[i];
  for (int i = (0); i < (m); ++i) cin >> b[i];
  for (int i = (0); i < (k + 1); ++i) {
    if (i >= n) {
      cout << -1 << '\n';
      return 0;
    }
    int pos = lower_bound(b, b + m, a[i] + t1) - b;
    pos += k - i;
    if (pos > m - 1) {
      cout << -1 << '\n';
      return 0;
    }
    res = max(res, b[pos] + t2);
  }
  cout << res << '\n';
  clock_t end = clock();
  double esecs = double(end - begin) / CLOCKS_PER_SEC;
  return 0;
}
