#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int NN = 10020;
const int MM = 1010;
const int inf = 1e9;
int a[NN];
int dp[NN][MM];
int n, m, G, R;
int dx[] = {-1, 1};
int out(int first) { return first < 1 || first > m; }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) scanf("%d", a + i);
  cin >> G >> R;
  for (int i = 0; i <= m; i++)
    for (int j = 0; j <= G; j++) dp[i][j] = inf;
  sort(a + 1, a + m + 1);
  a[m + 1] = n;
  for (int i = 1; i <= m + 1; i++) {
    if (a[i] - a[i - 1] > G) {
      puts("-1");
      return 0;
    }
  }
  priority_queue<pii, vector<pii>, greater<pii>> q;
  if (a[1] == G) {
    dp[1][0] = 1;
    q.push(pii(G, 1));
  } else {
    dp[1][a[1]] = 0;
    q.push(pii(a[1], 1));
  }
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    int dst = p.first / G;
    int u = p.second;
    int tp = p.first % G;
    if (dst > dp[u][tp]) continue;
    for (int i = 0; i < 2; i++) {
      int v = u + dx[i];
      if (out(v)) continue;
      int res = tp + abs(a[u] - a[v]);
      if (res > G) continue;
      if (res == G) {
        if (dp[v][0] > dp[u][tp] + 1) {
          dp[v][0] = dp[u][tp] + 1;
          q.push(pii(dp[v][0] * G, v));
          continue;
        }
      } else {
        if (dp[v][res] > dp[u][tp]) {
          dp[v][res] = dp[u][tp];
          q.push(pii(dp[v][res] * G + res, v));
          continue;
        }
      }
    }
  }
  int ans = inf;
  for (int i = 1; i <= m; i++) {
    if (a[i] + G < n) continue;
    if (dp[i][0] == inf) continue;
    ans = min(ans, dp[i][0] * (G + R) + n - a[i]);
  }
  if (ans == inf) ans = -1;
  cout << ans;
  return 0;
}
