#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const long long INF = 8e18;
const int maxn = 1e4 + 5;
const int maxm = 1e3 + 5;
long long dis[maxn][maxm], a[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) cin >> a[i];
  sort(a + 1, a + 1 + m);
  int g, r;
  cin >> g >> r;
  for (int i = 0; i < maxn; ++i)
    for (int j = 0; j < maxm; ++j) dis[i][j] = inf;
  deque<pair<int, int> > dq;
  dq.push_back({1, g});
  dis[1][g] = 0;
  while (!dq.empty()) {
    auto now = dq.front();
    dq.pop_front();
    int i = now.first, j = now.second;
    if (i < m) {
      int ni = i + 1, nj = j - a[i + 1] + a[i];
      if (nj > 0) {
        if (dis[ni][nj] > dis[i][j]) {
          dis[ni][nj] = dis[i][j];
          dq.push_front({ni, nj});
        }
      } else if (nj == 0) {
        nj = g;
        if (dis[ni][nj] > dis[i][j] + 1) {
          dis[ni][nj] = dis[i][j] + 1;
          dq.push_back({ni, nj});
        }
      }
    }
    if (i > 1) {
      int ni = i - 1, nj = j - a[i] + a[i - 1];
      if (nj > 0) {
        if (dis[ni][nj] > dis[i][j]) {
          dis[ni][nj] = dis[i][j];
          dq.push_front({ni, nj});
        }
      } else if (nj == 0) {
        nj = g;
        if (dis[ni][nj] > dis[i][j] + 1) {
          dis[ni][nj] = dis[i][j] + 1;
          dq.push_back({ni, g});
        }
      }
    }
  }
  long long ans = INF;
  for (int j = 0; j < g; ++j) {
    if (dis[m][j] == inf) continue;
    ans = min(ans, dis[m][j] * (g + r) + g - j);
  }
  if (dis[m][g] != inf) ans = min(ans, dis[m][g] * (g + r) - r);
  if (ans == INF)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
  return 0;
}
