#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 1e4 + 100;
int n, m, r, g;
bool vis[N][1010];
int a[N], dis[N][1010];
struct Node {
  int pos, step;
  Node(int pos, int step) : pos(pos), step(step) {}
};
int bfs() {
  int ans = -1;
  deque<Node> q;
  q.push_back(Node(0, 0));
  vis[0][0] = true;
  while (q.size()) {
    Node cur = q.front();
    q.pop_front();
    if (cur.step == 0) {
      int remain = n - a[cur.pos];
      if (remain <= g) {
        long long temp = dis[cur.pos][cur.step] * (g + r) + remain;
        if (ans == -1 || temp < ans) ans = temp;
      }
    }
    if (cur.step == g) {
      if (!vis[cur.pos][0]) {
        dis[cur.pos][0] = dis[cur.pos][g] + 1;
        vis[cur.pos][0] = true;
        q.push_back(Node(cur.pos, 0));
      }
      continue;
    }
    if (cur.pos > 1) {
      int pos = cur.pos - 1;
      int step = cur.step + a[cur.pos] - a[pos];
      if (step <= g && !vis[pos][step]) {
        dis[pos][step] = dis[cur.pos][cur.step];
        vis[pos][step] = true;
        q.push_front(Node(pos, step));
      }
    }
    if (cur.pos < m) {
      int pos = cur.pos + 1;
      int step = cur.step + a[pos] - a[cur.pos];
      if (step <= g && !vis[pos][step]) {
        dis[pos][step] = dis[cur.pos][cur.step];
        vis[pos][step] = true;
        q.push_front(Node(pos, step));
      }
    }
  }
  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;
}
