#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> D(M);
  for (int i = 0; i < M; i++) scanf("%d", &D[i]);
  sort(D.begin(), D.end());
  int G, R;
  cin >> G >> R;
  auto encode = [&](int i, int t) { return i * G + t; };
  vector<int> dist(M * G, 1e9);
  deque<int> que;
  dist[0] = 0;
  que.push_back(0);
  while (que.size()) {
    int i = que.front();
    que.pop_front();
    int x = i / G, g = i % G;
    if (x > 0) {
      int g2 = g + D[x] - D[x - 1];
      if (g2 <= G) {
        int j = encode(x - 1, g2 % G);
        int c = g2 / G;
        int d = dist[i] + c;
        if (d < dist[j]) {
          dist[j] = d;
          if (c) {
            que.push_back(j);
          } else {
            que.push_front(j);
          }
        }
      }
    }
    if (x < M - 1) {
      int g2 = g + D[x + 1] - D[x];
      if (g2 <= G) {
        int j = encode(x + 1, g2 % G);
        int c = g2 / G;
        int d = dist[i] + c;
        if (d < dist[j]) {
          dist[j] = d;
          if (c) {
            que.push_back(j);
          } else {
            que.push_front(j);
          }
        }
      }
    }
  }
  int ans = 1e9;
  for (int g = 0; g < G; g++) {
    int d = dist[encode(M - 1, g)];
    if (d == 1e9) continue;
    int res = d * (R + G) + g;
    if (g == 0) res -= R;
    ans = min(ans, res);
  }
  if (ans == 1e9) ans = -1;
  cout << ans << endl;
  return 0;
}
