#include <bits/stdc++.h>
using namespace std;
int dp[1005 * 10][1005], n, m, d[10 * 1005], g, r, ans;
deque<pair<int, int> > q;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> d[i];
  sort(d, d + m);
  cin >> g >> r;
  dp[0][0] = 1;
  q.push_front(make_pair(0, 0));
  ans = -1;
  while (!q.empty()) {
    pair<int, int> u = q.front();
    q.pop_front();
    if (u.second == 0) {
      int dist = n - d[u.first];
      if (dist <= g) {
        int rez = (dp[u.first][0] - 1) * (r + g) + dist;
        if (ans == -1)
          ans = rez;
        else
          ans = min(rez, ans);
      }
    }
    if (u.first) {
      int urm = d[u.first] - d[u.first - 1];
      if (u.second + urm == g && !dp[u.first - 1][0]) {
        dp[u.first - 1][0] = dp[u.first][u.second] + 1;
        q.push_back(make_pair(u.first - 1, 0));
      } else if (u.second + urm < g && !dp[u.first - 1][u.second + urm]) {
        dp[u.first - 1][u.second + urm] = dp[u.first][u.second];
        q.push_front(make_pair(u.first - 1, u.second + urm));
      }
    }
    if (u.first < m - 1) {
      int urm = d[u.first + 1] - d[u.first];
      if (u.second + urm == g && !dp[u.first + 1][0]) {
        dp[u.first + 1][0] = dp[u.first][u.second] + 1;
        q.push_back(make_pair(u.first + 1, 0));
      } else if (u.second + urm < g && !dp[u.first + 1][u.second + urm]) {
        dp[u.first + 1][u.second + urm] = dp[u.first][u.second];
        q.push_front(make_pair(u.first + 1, u.second + urm));
      }
    }
  }
  cout << ans;
  return 0;
}
