#include <bits/stdc++.h>
using namespace std;
const long long INF = 1E16;
const long long MOD = 1E9 + 7;
const long long N = 1e4 + 5;
long long t = 1;
long long n, a[N], m, g, r, F[N][1000 + 5];
void Input() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= m; i++) scanf("%lld", &a[i]);
  scanf("%lld%lld", &g, &r);
}
void Prepare() {}
bool Inqueue[N][1000 + 5];
void Solve() {
  a[0] = -INF;
  a[m + 1] = INF;
  sort(a + 1, a + 1 + m);
  F[1][0] = 0;
  for (long long i = 1; i <= m; i++)
    for (long long j = 0; j <= g; j++) F[i][j] = INF;
  F[1][0] = 0;
  deque<pair<long long, long long> > DQ;
  DQ.push_back({1, 0});
  Inqueue[1][0] = 1;
  long long ans = INF;
  while (DQ.size()) {
    long long u = DQ.front().first;
    long long du = DQ.front().second;
    Inqueue[u][du] = 0;
    DQ.pop_front();
    long long cost = 0;
    if (du == g) cost = r;
    long long deg = 0;
    if (du == g) deg = du;
    if (a[u] - a[u - 1] + du - deg <= g) {
      long long newtime = a[u] - a[u - 1] + du - deg;
      if (F[u - 1][newtime] > F[u][du] + a[u] - a[u - 1] + cost) {
        F[u - 1][newtime] = F[u][du] + a[u] - a[u - 1] + cost;
        if (!Inqueue[u - 1][newtime]) {
          Inqueue[u - 1][newtime] = true;
          DQ.push_back({u - 1, newtime});
        }
      }
    }
    if (a[u + 1] - a[u] + du - deg <= g) {
      long long newtime = a[u + 1] - a[u] + du - deg;
      if (F[u + 1][newtime] > F[u][du] + a[u + 1] - a[u] + cost) {
        F[u + 1][newtime] = F[u][du] + a[u + 1] - a[u] + cost;
        if (!Inqueue[u + 1][newtime]) {
          Inqueue[u + 1][newtime] = true;
          DQ.push_back({u + 1, newtime});
        }
      }
    }
  }
  for (long long i = 0; i <= g; i++) ans = min(ans, F[m][i]);
  if (ans == INF)
    cout << -1;
  else
    cout << ans;
}
int main() {
  if (fopen("test"
            ".inp",
            "r")) {
    freopen(
        "test"
        ".inp",
        "r", stdin);
    freopen(
        "test"
        ".out",
        "w", stdout);
  };
  while (t--) {
    Input();
    Prepare();
    Solve();
  }
}
