#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long mp(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return ret;
}
priority_queue<int, vector<int>, greater<int>> pq;
vector<int> v;
int n, m;
int g, r;
int vec[10000];
int dp[10000][1001];
char visit[10000][1001];
int main() {
  memset(dp, 127, sizeof(dp));
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &vec[i]);
  sort(vec, vec + m);
  scanf("%d %d", &g, &r);
  int ne, nc, ng;
  pair<int, int> tv;
  queue<pair<int, int>> q;
  dp[0][0] = 0;
  q.push({0, 0});
  while (!q.empty()) {
    tv = q.front();
    q.pop();
    if (tv.first) {
      ne = tv.first - 1;
      nc = vec[tv.first] - vec[tv.first - 1];
      ng = (nc + tv.second) == g ? 0 : nc + tv.second;
      if (ng < g && dp[ne][ng] > dp[tv.first][tv.second] + nc) {
        dp[ne][ng] = dp[tv.first][tv.second] + nc;
        if (!visit[ne][ng]) q.push({ne, ng});
      }
    }
    if (tv.first != m - 1) {
      ne = tv.first + 1;
      nc = vec[tv.first + 1] - vec[tv.first];
      ng = (nc + tv.second) == g ? 0 : nc + tv.second;
      if (ng < g && dp[ne][ng] > dp[tv.first][tv.second] + nc) {
        dp[ne][ng] = dp[tv.first][tv.second] + nc;
        if (!visit[ne][ng]) q.push({ne, ng});
      }
    }
  }
  int miv = 2e9;
  for (int i = 0; i < g; i++) miv = min(miv, dp[m - 1][i]);
  if (miv > 18e8) return !printf("-1");
  long long ans = miv;
  long long tt = miv / g;
  ans += tt * r;
  if (miv % g == 0) ans -= r;
  printf("%lld", ans);
}
