#include <bits/stdc++.h>
using namespace std;
const int MAXM = 10005, MAXG = 1005;
int n, m, g, r, ar[MAXM], stop[MAXM];
bool vis[MAXM][MAXG];
void route(vector<int>& v, int i, int j) {
  if (j < 0 || vis[i][j]) return;
  vis[i][j] = true;
  if (j == 0) {
    v.push_back(i);
    return;
  }
  if (i > 0) route(v, i - 1, j - (ar[i] - ar[i - 1]));
  if (i < m - 1) route(v, i + 1, j - (ar[i + 1] - ar[i]));
}
void solve() {
  scanf("%d%d", &n, &m);
  for (int((i)) = (0); ((i)) < ((m)); ((i))++) scanf("%d", ar + i);
  sort(ar, ar + m);
  scanf("%d%d", &g, &r);
  for (int((i)) = (0); ((i)) < ((MAXM)); ((i))++) {
    stop[i] = -1;
    for (int((j)) = (0); ((j)) < ((MAXG)); ((j))++) {
      vis[i][j] = false;
    }
  }
  queue<int> q;
  q.push(0);
  stop[0] = 0;
  vis[0][0] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vector<int> v;
    route(v, u, g);
    for (int x : v) {
      stop[x] = stop[u] + 1;
      q.push(x);
    }
  }
  int res = INT_MAX;
  for (int((i)) = (0); ((i)) < ((m)); ((i))++) {
    if (stop[i] >= 0 && n - ar[i] <= g) {
      int t = stop[i] * (r + g) + (n - ar[i]);
      if (n == ar[i]) t -= r;
      res = min(res, t);
    }
  }
  printf("%d", res == INT_MAX ? -1 : res);
}
int main() {
  solve();
  return 0;
}
