#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 20;
const int M = 1e4 + 10;
const int G = 1 << 10;
long long a[M], d[M][G], n, m, g, r;
deque<pair<long long, long long> > q;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  cin >> g >> r;
  sort(a, a + m);
  memset(d, 63, sizeof d);
  d[0][0] = 0;
  q.push_back({0, 0});
  while (q.size()) {
    auto X = q.front();
    q.pop_front();
    long long v = X.first, t = X.second;
    long long rem = g - (t % (g + 1));
    if (v) {
      if (abs(a[v] - a[v - 1]) <= rem) {
        long long time = abs(a[v] - a[v - 1]) + t;
        if (d[v - 1][time] > d[v][t]) {
          d[v - 1][time] = d[v][t];
          q.push_front({v - 1, time});
        }
      }
    }
    if (v < m - 1) {
      if (abs(a[v] - a[v + 1]) <= rem) {
        long long time = abs(a[v] - a[v + 1]) + t;
        if (d[v + 1][time] > d[v][t]) {
          d[v + 1][time] = d[v][t];
          q.push_front({v + 1, time});
        }
      }
    }
    if (!rem && d[v][0] > d[v][t] + g + r) {
      d[v][0] = d[v][t] + g + r;
      q.push_back({v, 0});
    }
  }
  long long ans = 1e18;
  for (int i = 0; i < m; i++) {
    long long dis = abs(a[i] - n);
    if (dis <= g) {
      ans = min(ans, d[i][0] + dis);
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 20; j++) {
    }
  }
  if (ans > 1e17) ans = -1;
  cout << ans;
}
