#include <bits/stdc++.h>
using namespace std;
long int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  vector<int> arr(n), brr(m);
  if (k >= m || k >= n) {
    cout << -1;
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    arr[i] += ta;
  }
  for (long long i = 0; i < m; i++) {
    cin >> brr[i];
  }
  int maxEle = INT_MIN;
  for (long long i = 0; i < k + 1; i++) {
    int pos = lower_bound(brr.begin(), brr.end(), arr[i]) - brr.begin();
    int tempPos = pos + (k - i);
    if (tempPos >= m) {
      cout << -1;
      return 0;
    }
    maxEle = max(maxEle, brr[tempPos] + tb);
  }
  cout << maxEle;
  return 0;
}
