#include <bits/stdc++.h>
using namespace std;
const int le = 1e4;
const int G = 1e3;
const long long int INF = numeric_limits<long long int>::max();
long long int d[le][G];
long long int a[le];
int n;
int r, g;
void bfs01(int si, int st) {
  deque<pair<int, int>> qu;
  qu.push_back({si, st});
  d[si][st] = 0;
  vector<pair<int, pair<int, int>>> es;
  while (!qu.empty()) {
    auto v = qu.front();
    qu.pop_front();
    int i = v.first;
    int j = v.second;
    es.clear();
    if ((i - 1 >= 0) && (a[i] - a[i - 1] + j < g))
      es.push_back({0, {i - 1, a[i] - a[i - 1] + j}});
    if ((i + 1 < n) && (a[i + 1] - a[i] + j < g))
      es.push_back({0, {i + 1, a[i + 1] - a[i] + j}});
    if ((i - 1 >= 0) && (a[i] - a[i - 1] + j == g))
      es.push_back({r + g, {i - 1, 0}});
    if ((i + 1 < n) && (a[i + 1] - a[i] + j == g))
      es.push_back({r + g, {i + 1, 0}});
    for (auto e : es) {
      int dist = e.first;
      int ei = e.second.first;
      int ej = e.second.second;
      if (d[i][j] + dist < d[ei][ej]) {
        d[ei][ej] = d[i][j] + dist;
        if (dist == 0) {
          qu.push_front({ei, ej});
        } else {
          qu.push_back({ei, ej});
        }
      }
    }
  }
}
int main() {
  iostream::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  cin >> g >> r;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= g; j++) {
      d[i][j] = INF;
    }
  }
  bfs01(0, 0);
  long long int res = INF;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < g; j++) {
      if (d[i][j] == INF) continue;
      if (a[n - 1] - a[i] + j > g) continue;
      res = min(res, d[i][j] + a[n - 1] - a[i] + j);
    }
  }
  if (res == INF) res = -1;
  cout << res << endl;
  return 0;
}
