#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e4 + 5;
bool vis[N][1005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> d;
  for (long long int i = 0, x; i < m; i++) {
    cin >> x;
    d.push_back(x);
  }
  sort(d.begin(), d.end());
  long long int g, r;
  cin >> g >> r;
  long long int tot = r + g;
  long long int inf = 1e15 + 5;
  long long int ans = inf;
  deque<pair<pair<long long int, long long int>, long long int>> q;
  vis[0][0] = 1;
  q.push_back({{0, 0}, 0});
  while (q.size()) {
    auto it = q.front();
    q.pop_front();
    long long int ind = it.first.first;
    long long int time = it.first.second;
    long long int loop = it.second;
    if (ind == m - 1) {
      ans = min(ans, tot * loop + time);
      continue;
    }
    if (ind) {
      long long int ntime = time + d[ind] - d[ind - 1];
      long long int nloop = loop;
      if (ntime == g) ntime = 0, nloop++;
      if (ntime < g && !vis[ind - 1][ntime]) {
        vis[ind - 1][ntime] = 1;
        if (ntime)
          q.push_front({{ind - 1, ntime}, nloop});
        else
          q.push_back({{ind - 1, ntime}, nloop});
      }
    }
    long long int ntime = time + d[ind + 1] - d[ind];
    long long int nloop = loop;
    if (ntime == g) ntime = 0, nloop++;
    if (ntime < g && !vis[ind + 1][ntime]) {
      vis[ind + 1][ntime] = 1;
      if (ntime)
        q.push_front({{ind + 1, ntime}, nloop});
      else
        q.push_back({{ind + 1, ntime}, nloop});
      if (ind + 1 == m - 1 && !ntime) ans = min(ans, tot * loop + g);
    }
  }
  if (ans == inf) ans = -1;
  cout << ans;
}
