#include <bits/stdc++.h>
#pragma GCC optimize("Ofast, unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getrnd(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
ll getrndll(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rng); }
template <typename T1, typename T2>
inline bool relax(T1& a, const T2& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool strain(T1& a, const T2& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const int M = 1e4 + 3, G = 1e3 + 3;
int d[M][G];
void solve() {
  ll n, r, g;
  cin >> n >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  cin >> g >> r;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j <= g; ++j) d[i][j] = -1;
  deque<pair<int, int>> scope;
  d[0][0] = 0;
  scope.emplace_back(0, 0);
  while (!scope.empty()) {
    int v = scope.front().first;
    int t = scope.front().second;
    scope.pop_front();
    if (t == g) {
      if (d[v][0] == -1) {
        d[v][0] = d[v][g] + 1;
        scope.push_back({v, 0});
      }
    } else {
      auto go = [&](int to) {
        if (0 <= to && to < n) {
          int nt = abs(a[v] - a[to]) + t;
          if (nt <= g && d[to][nt] == -1) {
            d[to][nt] = d[v][t];
            scope.push_front({to, nt});
          }
        }
      };
      go(v + 1);
      go(v - 1);
    }
  }
  ll ans = 1e18;
  for (int i = 0; i < n; ++i) {
    if (a[n - 1] - a[i] <= g && d[i][0] != -1)
      relax(ans, 1LL * d[i][0] * (r + g) + a[n - 1] - a[i]);
  }
  if (ans >= 1e18)
    cout << "-1\n";
  else
    cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  srand(time(0));
  int t = 1;
  while (t--) solve();
  return 0;
}
