#include <bits/stdc++.h>
using namespace std;
const long long N = 1e4 + 7;
const long long M = 1e3 + 7;
const long long INF = 1e18;
long long n, m, k, a[N], g, r, ans;
bool h[N][M], ok;
queue<pair<long long, long long> > q;
vector<long long> v;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) cin >> a[i];
  cin >> g >> r;
  sort(a + 1, a + m + 1);
  v.push_back(1);
  while (!v.empty()) {
    for (long long i : v) q.push({i, g});
    v.clear();
    ans += g;
    while (!q.empty()) {
      long long node = q.front().first, t = q.front().second;
      q.pop();
      if (h[node][t]) continue;
      h[node][t] = 1;
      if (node == m) {
        ans -= t;
        ok = 1;
        break;
      }
      if (t == 0) v.push_back(node);
      if (node > 1 && a[node] - a[node - 1] <= t)
        q.push({node - 1, t - a[node] + a[node - 1]});
      if (a[node + 1] - a[node] <= t)
        q.push({node + 1, t - a[node + 1] + a[node]});
    }
    if (ok == 1) break;
    ans += r;
  }
  if (ok)
    cout << ans << endl;
  else
    cout << -1 << endl;
}
