#include <bits/stdc++.h>
using namespace std;
const int MAXM = 1e4 + 10, MAXG = 1010, INF = (2 * MAXM + 1) * MAXG;
int d[MAXM], dist[MAXM][MAXG];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> d[i];
  sort(d, d + m);
  int g, r;
  cin >> g >> r;
  deque<pair<int, int> > Q;
  Q.push_back({0, 0});
  for (int i = 0; i < m; i++)
    for (int t = 0; t < g; t++) dist[i][t] = INF;
  dist[0][0] = 0;
  while (!Q.empty()) {
    int i = Q.front().first, t = Q.front().second;
    Q.pop_front();
    for (auto j : {i - 1, i + 1}) {
      if (j < 0 || j >= m) continue;
      int s = t + abs(d[i] - d[j]);
      if (s < g && dist[j][s] == INF) {
        dist[j][s] = dist[i][t];
        Q.push_front({j, s});
      } else if (s == g && dist[j][0] == INF) {
        dist[j][0] = dist[i][t] + 1;
        Q.push_back({j, 0});
      }
    }
  }
  int sol = INF;
  for (int i = 0; i < m; i++)
    for (int t = 0; t < g; t++) {
      if (dist[i][t] == INF) continue;
      int s = t + d[m - 1] - d[i];
      if (s <= g) sol = min(sol, dist[i][t] * (g + r) + s);
    }
  if (sol == INF) sol = -1;
  cout << sol << '\n';
  return 0;
}
