#include <bits/stdc++.h>
using namespace std;
long long n, m, g, r;
long long a[10005];
long long d[1005][10005];
long long vis[1005][10005];
struct node {
  long long time, pos;
  node(long long _t, long long _p) : time(_t), pos(_p) {}
};
long long bfs() {
  long long ans = -1;
  deque<node> q;
  vis[0][0] = 1;
  q.push_front(node(0, 0));
  while (!q.empty()) {
    node tmp = q.front();
    q.pop_front();
    if (tmp.time == 0) {
      long long re = n - a[tmp.pos];
      if (re <= g) {
        long long t = d[0][tmp.pos] * (g + r) + re;
        if (ans == -1 || t < ans) ans = t;
      }
    }
    if (tmp.time == g) {
      if (!vis[0][tmp.pos]) {
        vis[0][tmp.pos] = 1;
        d[0][tmp.pos] = d[g][tmp.pos] + 1;
        q.push_back(node(0, tmp.pos));
      }
      continue;
    }
    if (tmp.pos > 0) {
      long long need = tmp.time + a[tmp.pos] - a[tmp.pos - 1];
      if (need <= g && !vis[need][tmp.pos - 1]) {
        vis[need][tmp.pos - 1] = 1;
        d[need][tmp.pos - 1] = d[tmp.time][tmp.pos];
        q.push_front(node(need, tmp.pos - 1));
      }
    }
    if (tmp.pos < m - 1) {
      long long need = tmp.time + a[tmp.pos + 1] - a[tmp.pos];
      if (need <= g && !vis[need][tmp.pos + 1]) {
        vis[need][tmp.pos + 1] = 1;
        d[need][tmp.pos + 1] = d[tmp.time][tmp.pos];
        q.push_front(node(need, tmp.pos + 1));
      }
    }
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  cin >> g >> r;
  cout << bfs() << endl;
}
