#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (auto &i : a) cin >> i;
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  m = a.size();
  int g, r;
  cin >> g >> r;
  const int inf = 2e9;
  vector<vector<int>> dp(m, vector<int>(g, inf));
  queue<pair<int, int>> q0, q1;
  dp[0][0] = 0;
  q0.push({0, 0});
  while (!q0.empty()) {
    for (int i, j; !q0.empty();) {
      tie(i, j) = q0.front();
      q0.pop();
      for (int l = -1; l <= 1; l += 2)
        if (0 <= i + l && i + l < m && j + abs(a[i + l] - a[i]) <= g) {
          int w = j + abs(a[i + l] - a[i]);
          if (w != g && dp[i][j] < dp[i + l][w]) {
            dp[i + l][w] = dp[i][j];
            q0.push({i + l, w});
          }
          if (w == g && dp[i][j] + 1 < dp[i + l][0]) {
            dp[i + l][0] = dp[i][j] + 1;
            q1.push({i + l, 0});
          }
        }
    }
    swap(q0, q1);
  }
  const long long infl = numeric_limits<long long>::max();
  long long ans = infl;
  for (int i = 0; i < g; ++i)
    if (dp[m - 1][i] != inf)
      ans = min(ans, (long long)dp[m - 1][i] * (g + r) + i - (i == 0) * r);
  if (ans == infl) ans = -1;
  cout << ans << "\n";
  return 0;
}
