#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
const int M = 1e6 + 5;
const long long inf = 0x3f3f3f3f3f3f3f3f;
int n, m, g, r;
int a[N];
bool vis[N][1005];
long long d[N][1005];
struct node {
  int u, v;
  long long d;
  bool operator<(const node &b) const { return d > b.d; }
  node(){};
  node(int _u, int _v, long long _d) { u = _u, v = _v, d = _d; }
};
void solve() {
  memset(d, 0x3f, sizeof(d));
  d[1][0] = 0;
  deque<pair<long long, int> > q;
  q.push_front(pair<long long, int>(1, 0));
  while (!q.empty()) {
    pair<long long, int> cur = q.front();
    q.pop_front();
    int u = cur.first, v = cur.second;
    if (u > 1) {
      int t = v + a[u] - a[u - 1];
      int dis = d[u][v];
      int sta = t % g;
      if (t % g == 0) dis++;
      if (t <= g && d[u - 1][sta] > dis) {
        d[u - 1][sta] = dis;
        if (t % g)
          q.push_front(pair<long long, int>(u - 1, sta));
        else
          q.push_back(pair<long long, int>(u - 1, sta));
      }
    }
    if (u < m) {
      int t = v + a[u + 1] - a[u];
      int dis = d[u][v];
      int sta = t % g;
      if (t % g == 0) dis++;
      if (t <= g && d[u + 1][sta] > dis) {
        d[u + 1][sta] = dis;
        if (t % g)
          q.push_front(pair<long long, int>(u + 1, sta));
        else
          q.push_back(pair<long long, int>(u + 1, sta));
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i < (m + 1); i++) scanf("%d", &a[i]);
  sort(a + 1, a + m + 1);
  scanf("%d%d", &g, &r);
  solve();
  long long ans = inf;
  for (int i = (1); i < (g); i++) {
    if (d[m][i] == inf) continue;
    ans = min(ans, d[m][i] * (g + r) + i);
  }
  if (d[m][0] != inf) ans = min(ans, d[m][0] * (g + r) - r);
  if (ans == inf) ans = -1;
  printf("%d\n", ans);
  return 0;
}
