#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
using namespace std;
struct State {
  int idx, gt, dist;
  bool operator<(const State& x) const { return dist > x.dist; }
};
int N, M, D[10010], G, R;
int Dist[10010][1010];
priority_queue<State> pq;
void process(const State& curr, int nidx, int diff) {
  if (curr.gt == 0) {
    int nc = curr.dist + R + diff;
    int ngt = G - diff;
    if (G >= diff && nc < Dist[nidx][ngt]) {
      Dist[nidx][ngt] = nc;
      pq.push({.idx = nidx, .gt = ngt, .dist = nc});
    }
  } else {
    int nc = curr.dist + diff;
    int ngt = curr.gt - diff;
    if (curr.gt >= diff && nc < Dist[nidx][ngt]) {
      Dist[nidx][ngt] = nc;
      pq.push({.idx = nidx, .gt = ngt, .dist = nc});
    }
  }
}
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; i++) scanf("%d", &D[i]);
  sort(D, D + M);
  scanf("%d %d", &G, &R);
  memset(Dist, 1000000010, sizeof Dist);
  Dist[0][G] = 0;
  pq.push({.idx = 0, .gt = G, .dist = 0});
  int answer = -1;
  while (!pq.empty()) {
    const State curr = pq.top();
    pq.pop();
    if (Dist[curr.idx][curr.gt] < curr.dist) continue;
    if (D[curr.idx] == N) {
      answer = curr.dist;
      break;
    }
    if (curr.idx < M - 1) {
      int diff = D[curr.idx + 1] - D[curr.idx];
      process(curr, curr.idx + 1, diff);
    }
    if (curr.idx > 0) {
      int diff = D[curr.idx] - D[curr.idx - 1];
      process(curr, curr.idx - 1, diff);
    }
  }
  printf("%d\n", answer);
  return 0;
}
