#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> d(M);
  for (int i = 0; i < (int)(M); i++) cin >> d[i];
  int G, R;
  cin >> G >> R;
  sort((d.begin()), (d.end()));
  vector<int> dist(M * G, INT_MAX);
  dist[0] = 0;
  deque<pair<int, int> > que;
  que.emplace_back(0, 0);
  while (!que.empty()) {
    int v, g;
    tie(v, g) = que.front();
    que.pop_front();
    if (v < M - 1 && g + d[v + 1] - d[v] <= G) {
      int next = (g + d[v + 1] - d[v]) % G;
      if (dist[((v + 1) * G + (next))] != INT_MAX) continue;
      if (next == 0) {
        dist[((v + 1) * G + (next))] = dist[((v)*G + (g))] + 1;
        que.emplace_back(v + 1, 0);
      } else {
        dist[((v + 1) * G + (next))] = dist[((v)*G + (g))];
        que.emplace_front(v + 1, next);
      }
    }
    if (v > 0 && g + d[v] - d[v - 1] <= G) {
      int next = (g + d[v] - d[v - 1]) % G;
      if (dist[((v - 1) * G + (next))] != INT_MAX) continue;
      if (next == 0) {
        dist[((v - 1) * G + (next))] = dist[((v)*G + (g))] + 1;
        que.emplace_back(v - 1, 0);
      } else {
        dist[((v - 1) * G + (next))] = dist[((v)*G + (g))];
        que.emplace_front(v - 1, next);
      }
    }
  }
  int ans = INT_MAX;
  if (dist[((M - 1) * G + (0))] != INT_MAX)
    ans = dist[((M - 1) * G + (0))] * (G + R) - R;
  for (int i = (int)(1); i <= (int)(G - 1); i++)
    if (dist[((M - 1) * G + (i))] != INT_MAX)
      chmin(ans, dist[((M - 1) * G + (i))] * (G + R) + i);
  cout << (ans == INT_MAX ? -1 : ans) << "\n";
  return 0;
}
