#include <bits/stdc++.h>
using namespace std;
mt19937 myrand(time(0));
int n, m, g, r, ans;
int a[10002];
long long dist[10002][1002];
bool vis[10002][1002];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(), cout.tie();
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  m = unique(a, a + m) - a;
  cin >> g >> r;
  deque<pair<int, int>> d;
  vis[0][0] = 1;
  d.push_back({0, 0});
  ans = -1;
  while (!d.empty()) {
    int u = d.front().first;
    int t = d.front().second;
    d.pop_front();
    if (t == 0 && (n - a[u]) <= g) {
      long long tmp = dist[u][t] * (r + g) + (n - a[u]);
      if (ans == -1 || ans > tmp) {
        ans = tmp;
      }
    }
    if (t == g) {
      if (!vis[u][0]) {
        vis[u][0] = 1;
        dist[u][0] = dist[u][t] + 1;
        d.push_back({u, 0});
      }
      continue;
    }
    if (u) {
      int tmp = t + (a[u] - a[u - 1]);
      if (tmp <= g && !vis[u - 1][tmp]) {
        vis[u - 1][tmp] = 1;
        dist[u - 1][tmp] = dist[u][t];
        d.push_front({u - 1, tmp});
      }
    }
    if ((u + 2) < m) {
      int tmp = t + (a[u + 1] - a[u]);
      if (tmp <= g && !vis[u + 1][tmp]) {
        vis[u + 1][tmp] = 1;
        dist[u + 1][tmp] = dist[u][t];
        d.push_front({u + 1, tmp});
      }
    }
  }
  cout << ans << endl;
  return 0;
}
