#include <bits/stdc++.h>
using namespace std;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N = 3e5 + 10;
const long long MOD = 1e9 + 9;
const long long M1 = 1e18 + 3, M2 = 1e9 + 7;
const long long p1 = 197, p2 = 229;
const int rx[4] = {-1, 0, 1, 0};
const int ry[4] = {0, 1, 0, -1};
const int hx[8] = {-2, -2, -1, 1, 2, 2, 1, -1};
const int hy[8] = {-1, 1, 2, 2, 1, -1, -2, -2};
const long double eps = 1e-7;
const long double pi = acos(-1.0);
const long long INF = 2e14;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long a[n], b[m];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  if (k >= n || k >= m) {
    cout << "-1" << endl;
    return 0;
  }
  long long mn = -INF;
  for (int i = 0; i <= k; i++) {
    int l = 0, r = m - 1, ans = -1;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (b[mid] >= a[i] + ta) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    if (ans == -1 || ans + (k - i) >= m) {
      cout << "-1" << endl;
      return 0;
    }
    mn = max(mn, b[ans + (k - i)] + tb);
  }
  cout << mn << endl;
  return 0;
}
