#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> arr(m);
  for (int i = 0; i < m; ++i) {
    cin >> arr[i];
  }
  const int inf = 1e9;
  int green, red;
  cin >> green >> red;
  sort(arr.begin(), arr.end());
  vector<int> dist(green * m, inf);
  dist[0] = 0;
  deque<int> q;
  q.push_back(0);
  int res = inf;
  while (!q.empty()) {
    const int pos = q[0] % m;
    const int Time = q[0] / m;
    const int currDist = dist[q[0]];
    q.pop_front();
    if (Time + arr.back() - arr[pos] <= green) {
      res = min(res, Time + arr.back() - arr[pos] + currDist * (green + red));
      continue;
    }
    for (int newPos : {pos - 1, pos + 1}) {
      if (newPos < 0 || newPos >= m) continue;
      int newTime = Time + abs(arr[pos] - arr[newPos]);
      if (newTime > green) {
        continue;
      }
      newTime %= green;
      int newNode = newTime * m + newPos;
      int weight = (newTime == 0);
      if (dist[newNode] > weight + currDist) {
        dist[newNode] = weight + currDist;
        if (weight == 0) {
          q.push_front(newNode);
        } else {
          q.push_back(newNode);
        }
      }
    }
  }
  if (res == inf) res = -1;
  cout << res;
}
