#include <bits/stdc++.h>
using namespace std;
long long int BSer(long long int arr[], long long int n, long long int ser) {
  long long int start = 0, end = n - 1;
  long long int pos = -2;
  while (start <= end) {
    long long int mid = (start + end) / 2;
    if (arr[mid] == ser) {
      start = mid + 1;
    } else if (arr[mid] < ser) {
      pos = mid;
      start = mid + 1;
    } else if (arr[mid] > ser) {
      end = mid - 1;
    }
  }
  return pos;
}
int main() {
  long long int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long int a[n], b[m], temp;
  for (long long int i = 0; i < n; ++i) {
    cin >> temp;
    a[i] = temp + ta;
  }
  for (long long int i = 0; i < m; ++i) {
    cin >> b[i];
  }
  long long int calc[n];
  fill_n(calc, n, -5);
  for (long long int i = 0; i < n; ++i) {
    if (k - i < 0) break;
    if (a[i] < b[0]) {
      if (k - i < m)
        calc[i] = b[k - i];
      else
        calc[i] = -1;
    } else if (a[i] > b[m - 1]) {
      calc[i] = -1;
    } else {
      long long int ptr = BSer(b, m, a[i]);
      if (ptr != -2) {
        if (ptr + k + 1 - i >= m) {
          calc[i] = -1;
        } else {
          calc[i] = b[ptr + k + 1 - i];
        }
      } else {
        calc[i] = b[k - 1];
      }
    }
  }
  if (k >= n) {
    cout << "-1";
    return 0;
  }
  long long int ans = -1;
  for (long long int i = 0; i < n; ++i) {
    if (calc[i] == -5) break;
    if (calc[i] == -1) {
      cout << "-1";
      return 0;
    } else {
      if (calc[i] > ans) {
        ans = calc[i];
      }
    }
  }
  cout << ans + tb;
  return 0;
}
