#include <bits/stdc++.h>
using namespace std;
long long dp[10005][2005];
int d[10005];
int inq[10005][2005];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &d[i]);
  sort(d, d + m);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < 2005; j++) dp[i][j] = 2e18;
  }
  dp[0][0] = 0;
  int g, r;
  scanf("%d %d", &g, &r);
  queue<pair<int, int> > q;
  q.push(make_pair(0, 0));
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    inq[p.first][p.second] = 0;
    if (p.first == m - 1) continue;
    if (p.second == g) {
      if (dp[p.first][0] > dp[p.first][p.second] + r) {
        dp[p.first][0] = dp[p.first][p.second] + r;
        if (!inq[p.first][0]) {
          q.push(make_pair(p.first, 0));
          inq[p.first][0] = 1;
        }
      }
      continue;
    }
    int first = p.first + 1;
    int second = p.second + d[first] - d[first - 1];
    if (second <= g) {
      if (dp[first][second] > dp[p.first][p.second] + d[first] - d[first - 1]) {
        dp[first][second] = dp[p.first][p.second] + d[first] - d[first - 1];
        if (!inq[first][second]) {
          q.push(make_pair(first, second));
          inq[first][second] = 0;
        }
      }
    }
    if (p.first != 0) {
      int first = p.first - 1, second = p.second + d[p.first] - d[p.first - 1];
      if (second <= g) {
        if (dp[first][second] >
            dp[p.first][p.second] + d[p.first] - d[p.first - 1]) {
          dp[first][second] =
              dp[p.first][p.second] + d[p.first] - d[p.first - 1];
          if (!inq[first][second]) {
            q.push(make_pair(first, second));
            inq[first][second] = 0;
          }
        }
      }
    }
  }
  long long ans = 2e18;
  for (int i = 0; i <= g; i++) ans = min(ans, dp[m - 1][i]);
  if (ans > 1e18) {
    printf("-1\n");
  } else {
    printf("%lld\n", ans);
  }
}
