#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "O3", "unroll-loops")
using namespace std;
const long long INF = (long long)(1e18);
const long long inf = 1e18 + 7;
long double eps = 1e-15;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long mod = 998244353;
long long pows(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long c = pows(a, b / 2);
    return (c * c) % mod;
  }
  if (b % 2 == 1) return (a * pows(a, b - 1)) % mod;
}
vector<long long> fact, unfact;
long long getcnk(int n, int k) {
  long long res = (unfact[k] * unfact[n - k]) % mod;
  return (fact[n] * res) % mod;
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  vector<int> aa(m);
  for (int i = 0; i < m; i++) {
    cin >> aa[i];
  }
  int g, r;
  cin >> g >> r;
  deque<pair<int, int>> q;
  q.push_back({0, 0});
  vector<vector<long long>> d;
  d.resize(m, vector<long long>(g, inf));
  sort((aa).begin(), (aa).end());
  d[0][0] = 0;
  while (!q.empty()) {
    auto p = q.front();
    q.pop_front();
    int i = p.first, t = p.second;
    if (i > 0) {
      int t1 = aa[i] - aa[i - 1] + t;
      if (aa[i] - aa[i - 1] + t < g &&
          d[i - 1][aa[i] - aa[i - 1] + t] > d[i][t] + aa[i] - aa[i - 1]) {
        d[i - 1][aa[i] - aa[i - 1] + t] = d[i][t] + aa[i] - aa[i - 1];
        q.push_front({i - 1, t1});
      }
      if (t1 == g && d[i - 1][0] > d[i][t] + aa[i] - aa[i - 1]) {
        d[i - 1][0] = d[i][t] + aa[i] - aa[i - 1] + r;
        q.push_back({i - 1, 0});
      }
    }
    if (i < m - 1) {
      int t1 = aa[i + 1] - aa[i] + t;
      if (t1 < g && d[i + 1][t1] > d[i][t] + aa[i + 1] - aa[i]) {
        d[i + 1][t1] = d[i][t] + aa[i + 1] - aa[i];
        q.push_front({i + 1, t1});
      }
      if (t1 == g && d[i + 1][0] > d[i][t] + aa[i + 1] - aa[i]) {
        d[i + 1][0] = d[i][t] + aa[i + 1] - aa[i] + r;
        q.push_back({i + 1, 0});
      }
    }
  }
  if (d[m - 1][0] != inf) d[m - 1][0] -= r;
  long long mmin = inf;
  for (int i = 0; i < g; i++) mmin = min(mmin, d[m - 1][i]);
  if (mmin == inf) mmin = -1;
  cout << mmin;
}
