#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll M = 1e4 + 10;
const ll G = 1e3 + 10;
ll n, m, g, r;
vector<ll> d;
ll ansDep = -1;
ll ansT = -1;
bool seen[M][G];
ll ans = 1e17;
void bfs() {
  deque<tuple<ll, ll, ll> > q;
  q.emplace_front(0, 0, 0);
  while (!q.empty()) {
    auto at = q.front();
    q.pop_front();
    ll v = get<0>(at), tempo = get<1>(at), dep = get<2>(at);
    if (v == m - 1) {
      ans = min(ans, (r + g) * dep + tempo);
      continue;
    }
    seen[v][tempo] = true;
    ll distance = d[v + 1] - d[v];
    ll nt = distance + tempo;
    if (nt <= g and !seen[v + 1][nt % g]) {
      seen[v + 1][nt % g] = true;
      if (nt == g) {
        if (v + 1 != m - 1)
          q.emplace_back(v + 1, 0, dep + 1);
        else
          q.emplace_back(v + 1, g, dep);
      } else
        q.emplace_front(v + 1, nt, dep);
    }
    if (v > 0) {
      distance = d[v] - d[v - 1];
      nt = distance + tempo;
      if (nt <= g and !seen[v - 1][nt % g]) {
        seen[v - 1][nt % g] = true;
        if (nt == g)
          q.emplace_back(v - 1, 0, dep + 1);
        else
          q.emplace_front(v - 1, nt, dep);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  memset(seen, false, sizeof seen);
  cin >> n >> m;
  d.resize(m);
  for (ll &i : d) cin >> i;
  sort(d.begin(), d.end());
  cin >> g >> r;
  bfs();
  if (ans == 1e17)
    cout << "-1\n";
  else
    cout << ans << "\n";
  return 0;
}
