#include <bits/stdc++.h>
using namespace std;
int n, m;
int g, r;
int d[10007][1007];
bool vis[10007][1007];
int a[10007];
struct Node {
  int p, v;
};
long long bfs() {
  deque<Node> q;
  q.push_back({0, 0});
  vis[0][0] = 1;
  long long ans = -1;
  while (!q.empty()) {
    Node now = q.front();
    q.pop_front();
    if (now.v == 0) {
      int rem = n - a[now.p];
      if (rem <= g) {
        long long tmp = 1ll * d[now.p][now.v] * (g + r) + rem;
        if (ans == -1 || tmp < ans) {
          ans = tmp;
        }
      }
    }
    if (now.v == g) {
      if (!vis[now.p][0]) {
        d[now.p][0] = d[now.p][now.v] + 1;
        vis[now.p][0] = 1;
        q.push_back({now.p, 0});
      }
      continue;
    }
    if (now.p > 1) {
      int p = now.p - 1;
      int v = now.v + a[now.p] - a[p];
      if (v <= g && !vis[p][v]) {
        vis[p][v] = 1;
        d[p][v] = d[now.p][now.v];
        q.push_front({p, v});
      }
    }
    if (now.p < m) {
      int p = now.p + 1;
      int v = now.v + a[p] - a[now.p];
      if (v <= g && !vis[p][v]) {
        vis[p][v] = 1;
        d[p][v] = d[now.p][now.v];
        q.push_front({p, v});
      }
    }
  }
  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("%lld\n", bfs());
  return 0;
}
