#include <bits/stdc++.h>
using namespace std;
void pv(vector<long long int> arr, long long int size) {
  for (long long int i = 0; i < size; i++) {
    cout << arr[i] << ' ';
  }
}
void gv(vector<long long int> &arr) {
  long long int size = arr.size();
  for (long long int i = 0; i < size; i++) {
    cin >> arr[i];
  }
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, t1, t2, k;
  cin >> n >> m >> t1 >> t2 >> k;
  vector<long long int> a(n), b(m), cc(n, 0);
  gv(a);
  gv(b);
  if (k >= min(n, m)) {
    cout << -1;
    return 0;
  }
  long long int c = 0;
  long long int mm = 0;
  long long int p1 = 0;
  for (long long int i = 0; i < n; i++) {
    long long int p2;
    p2 = lower_bound(b.begin(), b.end(), a[i] + t1) - b.begin();
    cc[i] = p2;
  }
  long long int maxi = b[0] + t2;
  for (long long int i = 0; i < n; i++) {
    if (i > k) break;
    if (cc[i] + k - i >= m) {
      cout << -1;
      return 0;
    } else {
      maxi = max(maxi, b[cc[i] + k - i] + t2);
    }
  }
  cout << maxi;
  return 0;
}
