#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) long long idx,
               __attribute__((unused)) long long LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, long long idx, long long LINE_NUM, Head H,
               Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
const long long MAXM = 1E4 + 10, MAXG = 1E3 + 10;
long long n, m, g, r;
vector<long long> d;
long long dist[MAXM][MAXG];
void BFS() {
  deque<pair<long long, long long> > q = {{0, g}};
  dist[0][g] = dist[0][0] = 1;
  while (!q.empty()) {
    deque<pair<long long, long long> > qq = q;
    q.clear();
    while (!qq.empty()) {
      pair<long long, long long> pp = qq.front();
      qq.pop_front();
      long long idx = pp.first, t = pp.second;
      if (idx + 1 < m) {
        long long tn = t - (d[idx + 1] - d[idx]);
        if (tn > 0 && dist[idx + 1][tn] == 0) {
          qq.push_back({idx + 1, tn});
          dist[idx + 1][tn] = dist[idx][t] + d[idx + 1] - d[idx];
        } else if (tn == 0 && dist[idx + 1][g] == 0) {
          q.push_back({idx + 1, g});
          dist[idx + 1][0] = dist[idx][t] + d[idx + 1] - d[idx];
          dist[idx + 1][g] = dist[idx + 1][0] + r;
        }
      }
      if (idx - 1 >= 0) {
        long long tn = t - (d[idx] - d[idx - 1]);
        if (tn > 0 && dist[idx - 1][tn] == 0) {
          qq.push_back({idx - 1, tn});
          dist[idx - 1][tn] = dist[idx][t] + d[idx] - d[idx - 1];
        } else if (tn == 0 && dist[idx - 1][g] == 0) {
          q.push_back({idx - 1, g});
          dist[idx - 1][0] = dist[idx][t] + d[idx] - d[idx - 1];
          dist[idx - 1][g] = dist[idx - 1][0] + r;
        }
      }
    }
  }
}
int32_t main() {
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long x;
    cin >> x;
    d.push_back(x);
  }
  sort((d).begin(), (d).end());
  m = unique((d).begin(), (d).end()) - d.begin();
  d.resize(m);
  cin >> g >> r;
  BFS();
  long long res = -1;
  for (long long i = 0; i <= g; i++) {
    if (dist[m - 1][i] > 0 && (dist[m - 1][i] < res || res == -1))
      res = dist[m - 1][i];
  }
  if (res > -1)
    cout << res - 1;
  else
    cout << -1;
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
