#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long int a[n], b[m];
  for (int i = 0; i < n; i++) cin >> a[i], a[i] += ta;
  for (int i = 0; i < m; i++) cin >> b[i];
  if (k >= n || k >= m) {
    cout << -1 << "\n";
    return 0;
  }
  long long int d = 0;
  for (int i = 0, index; i < n && k >= 0; i++, k--) {
    index = lower_bound(b, b + m, a[i]) - b + k;
    if (index >= m) {
      cout << -1 << "\n";
      return 0;
    }
    d = max(d, b[index] + tb);
  }
  cout << d << "\n";
  return 0;
}
