#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
int n, m, g, r;
int a[N];
long long dp[N][1020] = {0};
struct node {
  int pos, time;
  node(int pos, int time) : pos(pos), time(time) {}
};
long long ans;
bool vis[N][1020] = {0};
bool bfs() {
  deque<node> que;
  que.push_front(node(0, 0));
  ans = 1e17;
  vis[0][0] = true;
  while (!que.empty()) {
    node vn = que.front();
    que.pop_front();
    if (vn.time == 0) {
      int tmp = n - a[vn.pos];
      if (tmp <= g) {
        long long tmp1 = dp[vn.pos][vn.time] * (g + r) + tmp;
        ans = min(ans, tmp1);
      }
    }
    if (vn.time == g) {
      if (!vis[vn.pos][0]) {
        vis[vn.pos][0] = true;
        dp[vn.pos][0] = dp[vn.pos][g] + 1;
        que.push_back(node(vn.pos, 0));
      }
      continue;
    }
    if (vn.pos > 1) {
      int tmp = vn.time + a[vn.pos] - a[vn.pos - 1];
      if (tmp <= g && !vis[vn.pos - 1][tmp]) {
        vis[vn.pos - 1][tmp] = true;
        dp[vn.pos - 1][tmp] = dp[vn.pos][vn.time];
        que.push_front(node(vn.pos - 1, tmp));
      }
    }
    if (vn.pos < m) {
      int tmp = vn.time + a[vn.pos + 1] - a[vn.pos];
      if (tmp <= g && !vis[vn.pos + 1][tmp]) {
        vis[vn.pos + 1][tmp] = true;
        dp[vn.pos + 1][tmp] = dp[vn.pos][vn.time];
        que.push_front(node(vn.pos + 1, tmp));
      }
    }
  }
  if (ans < 1e17) return true;
  return false;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; ++i) scanf("%d", &a[i]);
  a[0] = 0;
  scanf("%d %d", &g, &r);
  sort(a + 1, a + 1 + m);
  if (bfs())
    printf("%lld\n", ans);
  else
    puts("-1");
  return 0;
}
