#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
int main(int argc, char* argv[]) {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  int n, m;
  cin >> n >> m;
  int r, g;
  vector<int> safe(m);
  for (auto& si : (safe)) cin >> si;
  sort((safe).begin(), (safe).end());
  cin >> g >> r;
  vector<vector<ll>> dist(m, vector<ll>(g + 1, 1e18));
  deque<pair<int, int>> q;
  q.push_back({0, 0});
  dist[0][0] = 0;
  while (q.size()) {
    auto [c, t] = q.front();
    q.pop_front();
    if (t == g) {
      if (dist[c][t] + 1 < dist[c][0]) {
        dist[c][0] = dist[c][t] + 1;
        q.push_back({c, 0});
        continue;
      }
    }
    if (c > 0) {
      auto tl = t + safe[c] - safe[c - 1];
      if (tl <= g && dist[c - 1][tl] > dist[c][t]) {
        dist[c - 1][tl] = dist[c][t];
        q.push_front({c - 1, tl});
      }
    }
    if (c < m - 1) {
      auto tr = t + safe[c + 1] - safe[c];
      if (tr <= g && dist[c + 1][tr] > dist[c][t]) {
        dist[c + 1][tr] = dist[c][t];
        q.push_front({c + 1, tr});
      }
    }
  }
  ll mi = LONG_LONG_MAX;
  for (int i = (0); i < (g + 1); ++i) {
    if (dist[m - 1][i] <= m) {
      mi = min(mi, i + dist[m - 1][i] * (r + g));
    }
  }
  cout << (mi == LONG_LONG_MAX ? -1ll : mi);
  cout.flush();
  return 0;
}
