#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10050;
int n, m;
int d[MAXN];
bool used[MAXN][1050];
int g, r;
priority_queue<pair<int, int> > q;
int mnTime[MAXN];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &d[i]);
  sort(d, d + m);
  scanf("%d %d", &g, &r);
  for (int i = 0; i < m; i++) mnTime[i] = -1;
  mnTime[0] = 0;
  used[0][0] = true;
  q.push({0, 0});
  int curWait = 0;
  vector<int> nxt;
  while (true) {
    while (!q.empty()) {
      int tm = -q.top().first, idx = q.top().second;
      q.pop();
      if (idx > 0 && tm + d[idx] - d[idx - 1] <= g) {
        int go = idx - 1, goTm = tm + d[idx] - d[idx - 1];
        if (!used[go][goTm]) {
          used[go][goTm] = true;
          q.push({-goTm, go});
          if (goTm == g && mnTime[go] == -1) {
            nxt.push_back(go);
            mnTime[go] = curWait + 1;
          }
        }
      }
      if (idx + 1 < m && tm + d[idx + 1] - d[idx] <= g) {
        int go = idx + 1, goTm = tm + d[idx + 1] - d[idx];
        if (!used[go][goTm]) {
          used[go][goTm] = true;
          q.push({-goTm, go});
          if (goTm == g && mnTime[go] == -1) {
            nxt.push_back(go);
            mnTime[go] = curWait + 1;
          }
        }
      }
    }
    if ((int)nxt.size() == 0) break;
    curWait++;
    for (int v : nxt) {
      used[v][0] = true;
      q.push({0, v});
    }
    nxt.clear();
  }
  long long ans = -1;
  for (int i = 0; i < m; i++) {
    if (mnTime[i] == -1) continue;
    if (d[m - 1] - d[i] <= g) {
      long long curAns = 1ll * (g + r) * mnTime[i];
      curAns += d[m - 1] - d[i];
      if (ans == -1 || ans > curAns) ans = curAns;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
