#include <bits/stdc++.h>
using namespace std;
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)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int 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 double PI = 3.14159265358979323846;
const double eps = (1e-10);
int isGreater(long double x, long double y) {
  if (abs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
int W, m, g, r;
const int MAX_N = 1e4 + 4;
int d[MAX_N];
struct S {
  int idx, t;
  long long cost;
  bool operator<(const S &other) const { return cost > other.cost; }
};
const int MAX_T = 2002;
long long dist[MAX_N][MAX_T];
const long long INF = LLONG_MAX / 4;
int cDistance(int i, int j) { return abs(d[i] - d[j]); }
long long dijkstra() {
  for (int i = 0; i < MAX_N; ++i)
    for (int j = 0; j < MAX_T; ++j) dist[i][j] = INF;
  priority_queue<S> pq;
  pq.push({0, 0, 0});
  dist[0][0] = 0;
  while (!pq.empty()) {
    S s = pq.top();
    pq.pop();
    int idx = s.idx, t = s.t;
    long long cost = s.cost;
    if (dist[idx][t] < cost) continue;
    if (d[idx] == W) return cost;
    for (int to = idx - 1; to <= idx + 1; to += 2) {
      if (to < 0 || to >= m) continue;
      int cd = cDistance(idx, to);
      if (cd <= g - t && t < g) {
        if (dist[to][cd + t] > cost + cd) {
          dist[to][cd + t] = cost + cd;
          pq.push({to, cd + t, cost + cd});
        }
      }
      if (cd <= g && t >= g) {
        long long cNext = cost + r + g - t + cd;
        if (dist[to][cd] > cNext) {
          dist[to][cd] = cNext;
          pq.push({to, cd, cNext});
        }
      }
    }
  }
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> W >> m;
  for (int i = 0; i < m; ++i) cin >> d[i];
  sort(d, d + m);
  cin >> g >> r;
  cout << dijkstra();
  return 0;
}
