#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int mod = 1e9 + 7;
const long long N = 1e4 + 5, K = 105;
const long long oo = 1e18 + 5;
const int si = (1 << 20);
const int INF = (1 << 30);
const long long M = 1e3 + 5;
const double INFdb = 1e10;
int n, m;
bool used[N][M];
int dp[N][M];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  vector<int> p(m);
  for (int& x : p) cin >> x;
  sort((p).begin(), (p).end());
  int tG, tR;
  cin >> tG >> tR;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) dp[i][j] = -1;
  }
  dp[0][0] = 0;
  deque<pair<int, int>> Q;
  Q.push_back(make_pair(0, 0));
  while (!Q.empty()) {
    pair<int, int> ele = Q.front();
    Q.pop_front();
    int i = ele.first;
    int t = ele.second;
    if (used[i][t]) continue;
    used[i][t] = 1;
    if (i > 0) {
      int new_t = t + p[i] - p[i - 1];
      if (new_t <= tG) {
        if (dp[i - 1][new_t] == -1) {
          dp[i - 1][new_t] = dp[i][t];
          Q.push_front(make_pair(i - 1, new_t));
        }
      }
    }
    if (i + 1 < m) {
      int new_t = t + p[i + 1] - p[i];
      if (new_t <= tG) {
        if (dp[i + 1][new_t] == -1) {
          dp[i + 1][new_t] = dp[i][t];
          Q.push_front(make_pair(i + 1, new_t));
        }
      }
    }
    if (t == tG) {
      if (dp[i][0] == -1 || dp[i][0] > dp[i][tG] + 1) {
        dp[i][0] = dp[i][tG] + 1;
        Q.push_back(make_pair(i, 0));
      }
    }
  }
  long long ans = oo;
  for (int i = 0; i <= tG; ++i) {
    if (dp[m - 1][i] == -1) continue;
    ans = min(ans, 1ll * dp[m - 1][i] * (tG + tR) + i);
  }
  if (ans >= oo) ans = -1;
  cout << ans;
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
