#include <bits/stdc++.h>
using namespace std;
const int N = 10010, M = 1010;
int a[N], d[N][M], n, m, g, r;
bool vis[N][M];
struct Node {
  int pos, t;
};
long long bfs() {
  deque<Node> q;
  q.push_back({0, 0});
  long long ans = -1;
  vis[0][0] = 1;
  while (q.size()) {
    Node now = q.front();
    q.pop_front();
    if (now.t == 0) {
      int res = n - a[now.pos];
      if (res <= g) {
        long long x = 1ll * d[now.pos][0] * (g + r) + res;
        if (ans == -1 || ans > x) ans = x;
      }
    }
    if (now.t == g) {
      if (!vis[now.pos][0]) {
        d[now.pos][0] = d[now.pos][now.t] + 1;
        vis[now.pos][0] = 1;
        q.push_back({now.pos, 0});
      }
      continue;
    }
    if (now.pos > 1) {
      int p = now.pos - 1;
      int t = now.t + a[now.pos] - a[p];
      if (t <= g && !vis[p][t]) {
        vis[p][t] = 1;
        d[p][t] = d[now.pos][now.t];
        q.push_front({p, t});
      }
    }
    if (now.pos < m) {
      int p = now.pos + 1;
      int t = now.t + a[p] - a[now.pos];
      if (t <= g && !vis[p][t]) {
        vis[p][t] = 1;
        d[p][t] = d[now.pos][now.t];
        q.push_front({p, t});
      }
    }
  }
  return 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 + 1 + m);
  printf("%d\n", bfs());
  return 0;
}
