#include <bits/stdc++.h>
const int MAXN = 2e7 + 5;
long long dis[MAXN];
bool vis[MAXN];
int n, m, g, r, d[MAXN];
inline int calc(int i, int j) { return (i - 1) * (g + 1) + j + 1; }
std::deque<int> q;
inline void relax(int x, int y, int z) {
  if (vis[y]) return;
  dis[y] = dis[x] + z;
  vis[y] = 1;
  if (z == 0)
    q.push_front(y);
  else
    q.push_back(y);
}
inline void bfs() {
  for (int i = 1; i <= calc(m, g); ++i) dis[i] = 1e18;
  dis[calc(1, g)] = 0;
  q.push_back(calc(1, g));
  vis[calc(1, g)] = 1;
  while (!q.empty()) {
    int v = q.front();
    q.pop_front();
    int q = 1 + v / (g + 1), r = v % (g + 1) - 1;
    if (r < 0) {
      q--;
      (r += (g + 1)) %= (g + 1);
    }
    if (v != calc(q, r)) {
      exit(-1);
    }
    if (r == 0) relax(calc(q, r), calc(q, g), 1);
    for (int i = std::max(1, q - 1); i <= std::min(m, q + 1); ++i) {
      if (i == q) continue;
      int tor = r - std::abs(d[i] - d[q]);
      if (tor < 0)
        continue;
      else
        relax(calc(q, r), calc(i, tor), 0);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  ++n;
  for (int i = 1; i <= m; ++i) scanf("%d", d + i), d[i]++;
  std::sort(d + 1, d + m + 1);
  scanf("%d%d", &g, &r);
  bfs();
  long long ans = 1e18;
  for (int i = 1; i <= m; ++i) {
    for (int j = 0; j <= g; ++j) {
      if (dis[calc(i, j)] == 1e18) continue;
      if (n - d[i] <= j) {
        ans = std::min(ans, 1ll * dis[calc(i, j)] * (g + r) + g - j + n - d[i]);
      }
    }
  }
  printf("%lld\n", ans == 1e18 ? -1 : ans);
  return 0;
}
