#include <bits/stdc++.h>
using namespace std;
const int M = 1e4 + 5, G = 1e3 + 5;
long long T[M][G];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> pos(m);
  for (int& x : pos) cin >> x;
  sort(pos.begin(), pos.end());
  int g, r;
  cin >> g >> r;
  vector<pair<int, int> > cur;
  cur.push_back({0, 0});
  fill(T[0], T[m], 1e9);
  T[0][0] = 0;
  long long ans = -1;
  for (long long t = 0; cur.size() && ans < 0; t++) {
    vector<pair<int, int> > nxt;
    while (cur.size()) {
      auto [p, dt] = cur.back();
      cur.pop_back();
      if (T[p][dt] < t) continue;
      if (dt + n - pos[p] <= g) {
        long long alt = t * (r + g) + dt + n - pos[p];
        if (ans < 0)
          ans = alt;
        else
          ans = min(ans, alt);
      }
      for (int o : {p - 1, p + 1})
        if (o >= 0 && o < m) {
          int ndt = dt + abs(pos[o] - pos[p]);
          if (ndt == g && T[o][0] > t + 1) {
            T[o][0] = t + 1;
            nxt.push_back({o, 0});
          } else if (ndt <= g && T[o][ndt] > t) {
            T[o][ndt] = t;
            cur.push_back({o, ndt});
          }
        }
    }
    swap(cur, nxt);
  }
  cout << ans << '\n';
}
