#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 3;
const int mod = 1e9 + 7;
const int inf = 1e4 + 7;
int n, m, a[N], g, r;
int d[N][1003];
inline void bfs01(int i, int k) {
  d[i][k] = 0;
  deque<pair<int, int> > q;
  q.push_back(make_pair(i, k));
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop_front();
    i = p.first;
    k = p.second;
    if (i > 1) {
      if (k + a[i] - a[i - 1] < g && d[i - 1][k + a[i] - a[i - 1]] == inf) {
        d[i - 1][k + a[i] - a[i - 1]] = d[i][k];
        q.push_front(make_pair(i - 1, k + a[i] - a[i - 1]));
      }
      if (k + a[i] - a[i - 1] == g && d[i - 1][0] == inf) {
        d[i - 1][0] = d[i][k] + 1;
        q.push_back(make_pair(i - 1, 0));
      }
    }
    if (i < m) {
      if (k + a[i + 1] - a[i] < g && d[i + 1][k + a[i + 1] - a[i]] == inf) {
        d[i + 1][k + a[i + 1] - a[i]] = d[i][k];
        q.push_front(make_pair(i + 1, k + a[i + 1] - a[i]));
      }
      if (k + a[i + 1] - a[i] == g && d[i + 1][0] == inf) {
        d[i + 1][0] = d[i][k] + 1;
        q.push_back(make_pair(i + 1, 0));
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) cin >> a[i];
  sort(a + 1, a + 1 + m);
  cin >> g >> r;
  for (int i = 1; i <= m; ++i)
    for (int j = 0; j <= g - 1; ++j) d[i][j] = inf;
  bfs01(1, 0);
  int ans = (d[m][0] - 1) * (g + r) + g;
  for (int i = 1; i <= g - 1; ++i) ans = min(ans, d[m][i] * (g + r) + i);
  if (ans < m * (g + r))
    cout << ans;
  else
    cout << -1;
  return 0;
}
