#include <bits/stdc++.h>
using namespace std;
int N, M, r, g, turn;
int is[1000005];
bool visit[10005][1005];
int dist[10005], A[10005];
vector<int> nxt;
void BFS() {
  queue<pair<int, int> > q;
  for (int u : nxt) {
    dist[u] = turn;
    q.push({u, g});
  }
  nxt.clear();
  int u, left, L, R;
  while (!q.empty()) {
    u = q.front().first;
    left = q.front().second;
    q.pop();
    if (left == 0) {
      nxt.push_back(u);
      continue;
    }
    if (u > 0) {
      L = left - A[u] + A[u - 1];
      if (L >= 0 && !visit[u - 1][L]) {
        visit[u - 1][L] = 1;
        q.push({u - 1, L});
      }
    }
    if (u < M) {
      R = left - A[u + 1] + A[u];
      if (R >= 0 && !visit[u + 1][R]) {
        visit[u + 1][R] = 1;
        q.push({u + 1, R});
      }
    }
  }
}
void solve() {
  memset(dist, -1, sizeof(dist));
  nxt.push_back(1);
  visit[1][0] = 1;
  for (turn = 0; turn < M; turn++) {
    BFS();
  }
  int ans = 1e9;
  for (int i = 1; i < M; i++) {
    if (A[i] + g < N || dist[i] == -1) continue;
    ans = min(ans, dist[i] * (g + r) + N - A[i]);
  }
  if (ans == 1e9)
    puts("-1");
  else
    printf("%d\n", ans);
}
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= M; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d %d", &g, &r);
  sort(A + 1, A + M + 1);
  for (int i = 1; i <= M; i++) {
    is[A[i]] = i;
  }
  solve();
}
