#include <bits/stdc++.h>
using namespace std;
int n, m, g, r;
void solve() {
  cin >> n >> m;
  vector<int> d = vector<int>(m);
  for (int i = (0); i < (m); ++i) cin >> d[i];
  sort(d.begin(), d.end());
  cin >> g >> r;
  vector<vector<bool>> vis = vector<vector<bool>>(m + 1, vector<bool>(g));
  vector<vector<int>> dis = vector<vector<int>>(m, vector<int>(g));
  deque<pair<int, int>> q;
  vis[0][0] = true;
  dis[0][0] = 0;
  q.push_back({0, 0});
  int ans = -1;
  while (q.size()) {
    int i = q.front().first;
    int t = q.front().second;
    q.pop_front();
    if (ans > -1 && (g + r) * dis[i][t] > ans) break;
    if (n - d[i] <= g - t) {
      int spr = (g + r) * dis[i][t] + t + n - d[i];
      if (ans == -1) ans = spr;
      if (spr < ans) ans = spr;
    }
    for (auto dir : {-1, 1}) {
      int j = i + dir;
      if (j < 0 || j >= m) continue;
      int tn = t + abs(d[j] - d[i]);
      if (tn > g) continue;
      int tm = tn;
      if (tm == g) tm -= g;
      if (vis[j][tm]) continue;
      vis[j][tm] = true;
      dis[j][tm] = dis[i][t] + (tn == g);
      if (tn == g)
        q.push_back({j, tm});
      else
        q.push_front({j, tm});
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
