#include <bits/stdc++.h>
template <class C, class E>
inline bool contains(const C& container, const E& element) {
  return container.find(element) != container.end();
}
template <class T>
inline void checkmin(T& a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T& a, T b) {
  if (b > a) a = b;
}
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << std::setprecision(15);
  cout << std::fixed;
  int n, m;
  cin >> n >> m;
  vector<int> isl(m);
  for (int i = (0), _b = ((m)-1); i <= _b; i++) cin >> isl[i];
  sort((isl).begin(), (isl).end());
  int g, r;
  cin >> g >> r;
  long long inf = 2 * (g + r) * m;
  inf *= g;
  vector<vector<long long>> d(m, vector<long long>(g, inf));
  d[0][0] = 0;
  deque<pair<int, int>> q;
  q.push_front({0, 0});
  pair<int, int> vs[2];
  while (!q.empty()) {
    pair<int, int> vmin = q.front();
    q.pop_front();
    int vsc = 0;
    if (vmin.first < m - 1) {
      pair<int, int> ne = {vmin.first + 1,
                           vmin.second + isl[vmin.first + 1] - isl[vmin.first]};
      if (ne.second <= g) vs[vsc++] = ne;
    }
    if (vmin.first > 0) {
      pair<int, int> ne = {vmin.first - 1,
                           vmin.second + isl[vmin.first] - isl[vmin.first - 1]};
      if (ne.second <= g) vs[vsc++] = ne;
    }
    for (int i = 0; i < vsc; ++i) {
      pair<int, int>& ne = vs[i];
      ne.second %= g;
      long long w = (ne.second == 0) ? (g + r) : 0;
      if (d[vmin.first][vmin.second] + w < d[ne.first][ne.second]) {
        d[ne.first][ne.second] = d[vmin.first][vmin.second] + w;
        if (w == 0)
          q.push_front(ne);
        else
          q.push_back(ne);
      }
    }
  }
  long long minV = inf;
  for (int i = (0), _b = ((m)-1); i <= _b; i++) {
    long long delta = (n - isl[i]);
    if (d[i][0] != inf && delta <= g) checkmin(minV, delta + d[i][0]);
  }
  if (minV == inf)
    cout << -1;
  else
    cout << minV;
  return 0;
}
