#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int maxN = 10003;
const long long INF = 1000000000ll;
vector<int> G[maxN];
int dist[maxN][maxN / 10 + 3];
priority_queue<pair<int, int> > H;
int X[maxN];
void ins(int v, int d) { H.push({-dist[v][d], v << 10 | d}); }
void solve() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = (1); i < (m + 1); i++) scanf("%d", X + i);
  sort(X + 1, X + m + 1);
  int g, b;
  scanf("%d%d", &g, &b);
  for (int i = (1); i < (m + 1); i++)
    for (int j = (0); j < (g); j++) dist[i][j] = INF;
  dist[1][0] = 0;
  ins(1, 0);
  while (!H.empty()) {
    int d, v, r;
    tie(d, v) = H.top();
    H.pop();
    r = v & 1023;
    v >>= 10;
    if (dist[v][r] != -d) continue;
    long long prop = dist[v][r];
    int t = abs(X[v] - X[v - 1]) + r;
    if (t == g) prop++, t = 0;
    if (t < g and prop < dist[v - 1][t]) dist[v - 1][t] = prop, ins(v - 1, t);
    prop = dist[v][r];
    t = abs(X[v] - X[v + 1]) + r;
    if (t == g) prop++, t = 0;
    if (t < g and prop < dist[v + 1][t]) dist[v + 1][t] = prop, ins(v + 1, t);
  }
  long long cyk = g + b, res = INF * cyk;
  for (int r = (0); r < (g); r++) {
    long long prop = dist[m][r] * cyk + r;
    if (r == 0 and dist[m][r] != INF) prop -= b;
    res = min(res, prop);
  }
  if (res == INF * cyk) res = -1ll;
  printf("%lld\n", res);
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
