#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using pii = pair<int, int>;
int dp[10100][1100], d[10100];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) scanf("%d", &d[i]);
  sort(d + 1, d + m + 1);
  int g, r;
  cin >> g >> r;
  memset(dp, 0x3f, sizeof dp);
  dp[1][0] = 0;
  priority_queue<pii, vector<pii>, greater<pii>> q;
  q.push(pii(1, 0));
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    int i = p.first, c = p.second;
    if (i > 1) {
      int t = c + d[i] - d[i - 1];
      if (t == g) {
        if (dp[i - 1][0] > dp[i][c] + 1) {
          dp[i - 1][0] = dp[i][c] + 1;
          q.push(pii(i - 1, 0));
        }
      }
      if (t < g) {
        if (dp[i - 1][t] > dp[i][c]) {
          dp[i - 1][t] = dp[i][c];
          q.push(pii(i - 1, t));
        }
      }
    }
    if (i < m - 1) {
      int t = c + d[i + 1] - d[i];
      if (t == g) {
        if (dp[i + 1][0] > dp[i][c] + 1) {
          dp[i + 1][0] = dp[i][c] + 1;
          q.push(pii(i + 1, 0));
        }
      }
      if (t < g && dp[i + 1][t] > dp[i][c]) {
        dp[i + 1][t] = dp[i][c];
        q.push(pii(i + 1, t));
      }
    }
  }
  int ans = 0x3f3f3f3f;
  for (int i = 1; i < m; i++)
    if (d[i] >= d[m] - g) {
      if (dp[i][0] < 0x3f3f3f3f)
        ans = min(ans, (g + r) * dp[i][0] + d[m] - d[i]);
    }
  if (ans >= 0x3f3f3f3f) ans = -1;
  cout << ans << endl;
}
