#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, ta, tb, k;
  cin >> n >> m >> ta >> tb >> k;
  long long int arr[n];
  long long int arr1[m];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long int i = 0; i < m; i++) {
    cin >> arr1[i];
  }
  long long int arr3[n];
  long long int l = 0;
  long long int flag = 0;
  for (long long int i = 0; i < m; i++) {
    flag = 0;
    while (1) {
      if (arr[l] + ta <= arr1[i]) {
        arr3[l] = i;
        l++;
        if (l >= n) {
          flag = 1;
        } else {
          continue;
        }
      }
      break;
    }
    if (flag == 1) {
      break;
    }
  }
  if (l <= k) {
    cout << "-1" << endl;
    return 0;
  }
  long long int max = -1;
  for (long long int i = 0; i < n; i++) {
    if (i <= k) {
      if (arr3[i] + k - i < m) {
        if (arr1[arr3[i] + k - i] + tb > max) {
          max = arr1[arr3[i] + k - i] + tb;
        }
      } else {
        cout << "-1" << endl;
        return 0;
      }
    } else {
      break;
    }
  }
  cout << max << endl;
  return 0;
}
