#include <bits/stdc++.h>
using namespace std;
int poww(int a, int b, int md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const int MAXN = 1e4 + 10;
const int MAXG = 1e3 + 10;
const int INF = 2139062143;
const int MOD = 1e9 + 7;
int n, m, g, r, adj_sz;
pair<pair<int, int>, int> adj[2];
vector<int> v;
int val[MAXN], dist[MAXN][MAXG];
void adj_comp(int i, int j) {
  adj_sz = 0;
  if (i < m - 1) {
    int x = j - (val[i + 1] - val[i]);
    if (x >= 0) adj[adj_sz] = {{i + 1, x}, 0}, adj_sz++;
    if (j == 0 && val[i + 1] - val[i] <= g)
      adj[adj_sz] = {{i + 1, g - (val[i + 1] - val[i])}, g + r}, adj_sz++;
  }
  if (i > 0) {
    int x = j - (val[i] - val[i - 1]);
    if (x >= 0) adj[adj_sz] = {{i - 1, x}, 0}, adj_sz++;
    if (j == 0 && val[i] - val[i - 1] <= g)
      adj[adj_sz] = {{i - 1, g - (val[i] - val[i - 1])}, g + r}, adj_sz++;
  }
}
void bfs01() {
  dist[0][g] = 0;
  deque<pair<int, int> > q;
  q.push_back({0, g});
  while (!q.empty()) {
    pair<int, int> v = q.front();
    q.pop_front();
    adj_comp(v.first, v.second);
    for (int i = 0; i < adj_sz; i++) {
      pair<pair<int, int>, int> u = adj[i];
      if (dist[v.first][v.second] + u.second <
          dist[u.first.first][u.first.second]) {
        dist[u.first.first][u.first.second] =
            dist[v.first][v.second] + u.second;
        if (u.second == 0)
          q.push_front({u.first.first, u.first.second});
        else
          q.push_back({u.first.first, u.first.second});
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  cin >> g >> r;
  sort((v).begin(), (v).end());
  for (int i = 0; i < m; i++) val[i] = v[i];
  for (int i = 0; i < m; i++) {
    memset(dist[i], INF, sizeof dist[i]);
  }
  bfs01();
  int ans = INF;
  for (int i = 0; i <= g; i++) ans = min(ans, dist[m - 1][i] + g - i);
  if (ans >= INF) ans = -1;
  cout << ans << '\n';
  return 0;
}
