#include <bits/stdc++.h>
using namespace std;
const int N = 10100, M = 1010;
const long long INF = 1e18;
int n, k, m, nk, r, g, a[N], dp[N][M], cur;
pair<int, int> b[N * M], c[N * M];
bool was[N][M];
void first(int i, int j);
void ff(int i, int j, int x) {
  if (dp[i][j] <= x) return;
  dp[i][j] = x;
  if (x == cur)
    b[k++] = {i, j};
  else
    first(i, j);
}
void first(int i, int j) {
  if (was[i][j]) return;
  was[i][j] = 1;
  if (i > 0) {
    if (j + a[i] - a[i - 1] < g) ff(i - 1, j + a[i] - a[i - 1], dp[i][j]);
    if (j + a[i] - a[i - 1] == g) ff(i - 1, 0, dp[i][j] + 1);
  }
  if (i + 1 < m) {
    if (j + a[i + 1] - a[i] < g) ff(i + 1, j + a[i + 1] - a[i], dp[i][j]);
    if (j + a[i + 1] - a[i] == g) ff(i + 1, 0, dp[i][j] + 1);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &a[i]);
  scanf("%d%d", &g, &r);
  for (int i = 0; i < m; i++)
    for (int j = 0; j < g; j++) dp[i][j] = 1e9;
  sort(a, a + m);
  long long ans = INF;
  ff(0, 0, 0);
  while (true) {
    nk = 0;
    for (int i = 0; i < k; i++)
      if (dp[b[i].first][b[i].second] == cur) c[nk++] = b[i];
    if (nk == 0) break;
    cur++;
    k = 0;
    for (int i = 0; i < nk; i++) first(c[i].first, c[i].second);
  }
  if (was[m - 1][0]) ans = min(ans, 1ll * (r + g) * dp[m - 1][0] - r);
  for (int i = 1; i < g; i++)
    if (was[m - 1][i]) ans = min(ans, i + 1ll * (r + g) * dp[m - 1][i]);
  if (ans == INF) ans = -1;
  printf("%lld", ans);
}
