#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll dis[(ll)(1e7 + 7)], dd[(ll)(1e7 + 7)];
int main() {
  ll n, m, g, r;
  cin >> n >> m;
  ll ar[m], a[2] = {-1, 1};
  for (ll i = 0; i < m; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + m);
  cin >> g >> r;
  ll ch[g * m];
  for (ll i = 0; i < m * g; i++) {
    dis[i] = -1;
  }
  deque<ll> dq;
  dq.push_front(0);
  dis[0] = 0;
  while (dq.size()) {
    ll n = dq.front();
    dq.pop_front();
    ll i = n / g, r = n % g;
    for (ll j = 0; j < 2; j++) {
      ll ii = i + a[j];
      if (i + a[j] < 0 || i + a[j] >= m) {
        continue;
      }
      ll x = (r + abs(ar[i] - ar[ii])) % g + (ii)*g,
         d = dis[n] + abs(ar[i] - ar[ii]);
      if (dis[x] == -1 && d <= g) {
        dis[x] = d;
        dd[x] += dd[n] + abs(ar[i] - ar[ii]);
        if (dis[x] == g) {
          dq.push_back(x);
          dis[x] = 0;
          ch[x] = n;
        } else {
          dq.push_front(x);
          ch[x] = n;
        }
      }
    }
  }
  ll ma = (ll)(1e18);
  for (ll i = (m - 1) * g; i < m * g; i++) {
    if (dis[i] != -1) {
      ma = min(dd[i] + (dd[i] / g - (dd[i] % g == 0)) * r, ma);
    }
  }
  ma = ma == (ll)(1e18) ? -1 : ma;
  cout << ma << "\n";
}
