#include <bits/stdc++.h>
using namespace std;
const long long maxn = 10050;
long long l, n;
long long g, r;
long long visited[maxn][1010];
pair<long long, long long> cango[maxn];
vector<long long> v;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> l >> n;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  cin >> g >> r;
  sort(v.begin(), v.end());
  for (long long i = 0; i < (long long)v.size(); i++) {
    if (i != 0) cango[i + 1].first = v[i] - v[i - 1];
    if (i != (long long)v.size() - 1) cango[i + 1].second = v[i + 1] - v[i];
  }
  deque<pair<long long, pair<long long, long long> > > q;
  q.push_back(pair<long long, pair<long long, long long> >(
      0, pair<long long, long long>(1, g)));
  visited[1][g] = 1;
  long long ans = LLONG_MAX / 2;
  while (!q.empty()) {
    pair<long long, pair<long long, long long> > cur = q.front();
    q.pop_front();
    long long x = cur.second.first, t = cur.second.second, d = cur.first;
    if (x == n) {
      if (t == g) d -= r;
      ans = min(ans, d);
      continue;
    }
    long long newd, newt;
    if (x != 1) {
      newt = t - cango[x].first, newd = d + cango[x].first;
      if (newt == 0 and !visited[x - 1][g]) {
        visited[x - 1][g] = 1;
        newd += r;
        q.push_back(pair<long long, pair<long long, long long> >(
            newd, pair<long long, long long>(x - 1, g)));
      } else if (newt > 0 and !visited[x - 1][newt]) {
        visited[x - 1][newt] = 1;
        q.push_front(pair<long long, pair<long long, long long> >(
            newd, pair<long long, long long>(x - 1, newt)));
      }
    }
    newd = d + cango[x].second;
    newt = t - cango[x].second;
    if (newt == 0 and !visited[x + 1][g]) {
      visited[x + 1][g] = 1;
      newd += r;
      q.push_back(pair<long long, pair<long long, long long> >(
          newd, pair<long long, long long>(x + 1, g)));
    } else if (newt > 0 and !visited[x + 1][newt]) {
      visited[x + 1][newt] = 1;
      q.push_front(pair<long long, pair<long long, long long> >(
          newd, pair<long long, long long>(x + 1, newt)));
    }
  }
  if (ans == LLONG_MAX / 2)
    cout << -1;
  else
    cout << ans;
}
