#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int inf = 1e9 + 7;
const int N = 1e4 + 5;
int d[N], d2[N];
int dist[N];
const int mlim = 2003;
unordered_map<bitset<mlim>, bitset<mlim>> cache;
int main() {
  int n = 10000, m = 10001;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    d[i] = i - 1;
    scanf("%d", &d[i]);
    dist[i] = inf;
  }
  sort(d + 1, d + m + 1);
  int g = 1000, r = 1000;
  scanf("%d %d", &g, &r);
  for (int i = 2; i <= m; i++)
    if (d[i] - d[i - 1] > g) return !printf("-1\n");
  deque<int> pq;
  pq.push_back(1);
  int ans = inf;
  dist[1] = 0;
  while ((int)(pq).size()) {
    int u = pq.front();
    pq.pop_front();
    if (n - d[u] <= g) ans = min(ans, dist[u] + n - d[u]);
    if (ans != inf) continue;
    const int lim = 1001;
    bitset<mlim> dpL = 0, dpR = 0, pos = 0;
    dpL[lim] = 1, dpR[lim] = 1;
    pos[lim] = 1;
    int c = 0;
    for (int i = 1; u + i <= m && d[u + i] - d[u] <= g; i++)
      pos[lim + d[u + i] - d[u]] = 1, c++;
    for (int i = 1; u - i > 0 && d[u] - d[u - i] <= min(g, lim); i++)
      pos[lim - d[u] + d[u - i]] = 1;
    if (!c) continue;
    if (cache.count(pos))
      dpL = cache[pos];
    else {
      for (int i = 1; i <= g; i++) {
        dpL = dpL >> 1;
        dpR = dpR << 1;
        tie(dpL, dpR) = make_pair(dpL | (dpR & pos), dpR | (dpL & pos));
      }
      cache[pos] = dpL | dpR;
    }
    for (int i = 1; u + i <= m && d[u + i] - d[u] <= g; i++) {
      int v = d[u + i] - d[u];
      if ((dpL[v + lim] == 0 && dpR[v + lim] == 0) || dist[u + i] != inf)
        continue;
      dist[u + i] = dist[u] + g + r;
      pq.push_back(u + i);
    }
    for (int i = 1; u - i > 0 && d[u] - d[u - i] <= min(g, lim); i++) {
      int v = d[u] - d[u - i];
      if ((dpL[lim - v] == 0 && dpR[lim - v] == 0) || dist[u - i] != inf)
        continue;
      dist[u - i] = dist[u] + g + r;
      pq.push_back(u - i);
    }
  }
  if (ans == inf) ans = -1;
  printf("%d\n", ans);
  return 0;
}
