#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
const int mod = 1e9 + 7;
const long double inf = 1e18;
int b[1010][N];
int a[N];
void solve() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a, a + m);
  int g, r;
  scanf("%d%d", &g, &r);
  queue<pair<int, int> > q;
  q.push(pair<int, int>(0, 0));
  b[0][0] = 1;
  int cur = 1;
  int ans = 1e9;
  while (!q.empty()) {
    queue<int> q2;
    while (!q.empty()) {
      pair<int, int> p = q.front();
      if (p.second == g) {
        q2.push(p.first);
      }
      q.pop();
      if (p.first > 0 && p.second + a[p.first] - a[p.first - 1] <= g &&
          !b[p.second + a[p.first] - a[p.first - 1]][p.first - 1]) {
        q.push(pair<int, int>(p.first - 1,
                              p.second + a[p.first] - a[p.first - 1]));
        b[p.second + a[p.first] - a[p.first - 1]][p.first - 1] = cur;
      }
      if (p.first < m - 1 && p.second + a[p.first + 1] - a[p.first] <= g &&
          !b[p.second + a[p.first + 1] - a[p.first]][p.first + 1]) {
        q.push(pair<int, int>(p.first + 1,
                              p.second + a[p.first + 1] - a[p.first]));
        b[p.second + a[p.first + 1] - a[p.first]][p.first + 1] = cur;
      }
      if (p.first == m - 2 && p.second + a[p.first + 1] - a[p.first] <= g) {
        ans = min(ans, (cur - 1) * g + (cur - 1) * r + p.second +
                           a[p.first + 1] - a[p.first]);
      }
    }
    cur++;
    while (!q2.empty()) {
      q.push(pair<int, int>(q2.front(), 0));
      q2.pop();
    }
  }
  if (ans == 1e9) ans = -1;
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
