#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int mxm = 1e4 + 2;
const int mxg = 1e3 + 2;
int d[mxm];
int dist[mxm][mxg];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &d[i]);
  int g, r;
  scanf("%d %d", &g, &r);
  int ans = 2e9;
  sort(d, d + m);
  memset(dist, -1, sizeof dist);
  deque<pii> dq;
  dq.emplace_back(0, 0);
  dist[0][0] = 0;
  while (!dq.empty()) {
    auto u = dq.front();
    dq.pop_front();
    int i = u.first, t = u.second;
    if (t == 0) {
      int rem = n - d[i];
      if (rem <= g) {
        int tmp = (dist[i][t] * (r + g)) + rem;
        ans = min(ans, tmp);
      }
    }
    if (t == g) {
      if (dist[i][0] == -1) {
        dist[i][0] = 1 + dist[i][t];
        dq.push_back(pii(i, 0));
      }
      continue;
    }
    if (i + 1 < m) {
      int t1 = t + d[i + 1] - d[i];
      if (t1 <= g and dist[i + 1][t1] == -1) {
        dist[i + 1][t1] = dist[i][t];
        dq.push_front(pii(i + 1, t1));
      }
    }
    if (i > 0) {
      int t1 = t + d[i] - d[i - 1];
      if (t1 <= g and dist[i - 1][t1] == -1) {
        dist[i - 1][t1] = dist[i][t];
        dq.push_front(pii(i - 1, t1));
      }
    }
  }
  if (ans == 2e9) ans = -1;
  printf("%d\n", ans);
}
