#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > dist;
vector<vector<bool> > was;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> arr(m + 2);
  for (int i = 0; i < m; ++i) cin >> arr[i + 1];
  m += 2;
  arr.back() = n;
  sort(arr.begin(), arr.end());
  long long int G, R;
  cin >> G >> R;
  dist.resize(m, vector<int>(G + 1));
  was.resize(m, vector<bool>(G + 1));
  deque<pair<int, int> > bfs;
  bfs.push_back({0, 0});
  was[0][0] = 1;
  long long int ans = -1;
  while (bfs.size()) {
    int v = bfs.front().first;
    int t = bfs.front().second;
    bfs.pop_front();
    if (t == 0) {
      int tTo = n - arr[v];
      if (tTo <= G) {
        long long int tempAns = (R + G) * dist[v][t] + tTo;
        if (ans == -1 || ans > tempAns) ans = tempAns;
      }
    }
    if (t == G) {
      if (was[v][0] == 0) {
        dist[v][0] = dist[v][t] + 1;
        bfs.push_back({v, 0});
        was[v][0] = 1;
      }
      continue;
    }
    if (v) {
      int tTo = t + arr[v] - arr[v - 1];
      if (tTo <= G && was[v - 1][tTo] == 0) {
        was[v - 1][tTo] = 1;
        dist[v - 1][tTo] = dist[v][t];
        bfs.push_front({v - 1, tTo});
      }
    }
    if (v < m - 1) {
      int tTo = t + arr[v + 1] - arr[v];
      if (tTo <= G && was[v + 1][tTo] == 0) {
        was[v + 1][tTo] = 1;
        dist[v + 1][tTo] = dist[v][t];
        bfs.push_front({v + 1, tTo});
      }
    }
  }
  cout << ans;
}
