#include <bits/stdc++.h>
using namespace std;
const long long logN = 20;
const long long M = 1000000007;
const long long INF = 1e12;
const long long N = 10005;
const long long G = 1005;
long long D[N];
int dist[N][G];
bool vis[N][G];
void solve() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) cin >> D[i];
  sort(D, D + m);
  long long g, r;
  cin >> g >> r;
  deque<pair<int, int> > dq;
  dq.push_back({0, 0});
  vis[0][0] = 1;
  long long ans = -1;
  while (!dq.empty()) {
    pair<int, int> p = dq.front();
    dq.pop_front();
    long long v = p.first;
    long long t = p.second;
    if (t == 0) {
      long long rem = n - D[v];
      if (rem <= g) {
        long long cnt = (r + g) * dist[v][t] + rem;
        if (ans == -1 or ans > cnt) ans = cnt;
      }
    }
    if (t == g) {
      if (vis[v][0] == 0) {
        dist[v][0] = dist[v][t] + 1;
        dq.push_back({v, 0});
        vis[v][0] = 1;
      }
      continue;
    }
    if (v > 0) {
      long long rem = t + D[v] - D[v - 1];
      if (rem <= g and vis[v - 1][rem] == 0) {
        vis[v - 1][rem] = 1;
        dist[v - 1][rem] = dist[v][t];
        dq.push_front({v - 1, rem});
      }
    }
    if (v < (m - 1)) {
      long long rem = t + D[v + 1] - D[v];
      if (rem <= g and vis[v + 1][rem] == 0) {
        dist[v + 1][rem] = dist[v][t];
        vis[v + 1][rem] = 1;
        dq.push_front({v + 1, rem});
      }
    }
  }
  cout << ans << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long no;
  no = 1;
  while (no--) {
    solve();
  }
  return 0;
}
