#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline bool chmax(A &a, B b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename A, typename B>
inline bool chmin(A &a, B b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll << 30;
constexpr ll longINF = 1ll << 60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> d(M);
  for (int i = (0); i < (M); ++i) scanf("%d", &d[i]);
  sort(begin(d), end(d));
  int G, R;
  cin >> G >> R;
  vector<vector<int>> mn(M, vector<int>(G, INF));
  deque<pii> deq;
  mn[0][0] = 0;
  deq.emplace_front(0, 0);
  while (!deq.empty()) {
    pii cur = deq.front();
    deq.pop_front();
    int u = cur.first;
    int g = cur.second;
    if (u > 0 && d[u] - d[u - 1] <= G) {
      int nd = g + d[u] - d[u - 1];
      if (nd <= G && chmin(mn[u - 1][nd % G], mn[u][g] + (nd == G))) {
        if (nd == G)
          deq.emplace_back(u - 1, nd % G);
        else
          deq.emplace_front(u - 1, nd % G);
      }
    }
    if (u < M - 1 && d[u + 1] - d[u] <= G) {
      int nd = g + d[u + 1] - d[u];
      if (nd <= G && chmin(mn[u + 1][nd % G], mn[u][g] + (nd == G))) {
        if (nd == G)
          deq.emplace_back(u + 1, nd % G);
        else
          deq.emplace_front(u + 1, nd % G);
      }
    }
  }
  ll ans = longINF;
  for (int i = (0); i < (M); ++i) {
    if (mn[i][0] == INF) continue;
    if (d[i] + G < N) continue;
    chmin(ans, (ll)(G + R) * mn[i][0] + N - d[i]);
  }
  if (ans == longINF) ans = -1;
  cout << ans << endl;
  return 0;
}
