#include <bits/stdc++.h>
using namespace std;
const long long sz = 1e4 + 10;
bool vis[sz][1009];
long long land[sz];
struct node {
  long long pos, tim, tot;
};
int main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) scanf("%lld", &land[i]);
  sort(land + 1, land + m + 1);
  long long g, r;
  cin >> g >> r;
  long long f = land[1];
  if (f > g) {
    cout << -1 << endl;
    return 0;
  }
  deque<node> q;
  q.push_front({1, f, f});
  vis[1][f] = 1;
  long long ans = (1LL << 62);
  while (!q.empty()) {
    node u = q.front();
    q.pop_front();
    if (land[u.pos] == n) {
      ans = min(ans, u.tot);
      continue;
    }
    long long baki = g - u.tim;
    if (baki == 0) {
      u.tot += r, u.tim = 0;
      if (!vis[u.pos][u.tim]) {
        vis[u.pos][u.tim] = 1;
        q.push_back({u.pos, u.tim, u.tot});
      }
      continue;
    }
    long long lagbe = n - land[u.pos];
    if (lagbe <= baki) {
      ans = min(ans, u.tot + lagbe);
    }
    long long lft = u.pos - 1, rgt = u.pos + 1;
    if (lft >= 1) {
      long long rest = g - u.tim;
      long long need = abs(land[u.pos] - land[lft]);
      if (need <= rest) {
        long long now = u.tim + need;
        long long tot = u.tot + need;
        if (!vis[lft][now]) {
          vis[lft][now] = 1;
          q.push_front({lft, now, tot});
        }
      }
    }
    if (rgt <= n) {
      long long rest = g - u.tim;
      long long need = abs(land[u.pos] - land[rgt]);
      if (need <= rest) {
        long long now = u.tim + need;
        long long tot = u.tot + need;
        if (!vis[rgt][now]) {
          vis[rgt][now] = 1;
          q.push_front({rgt, now, tot});
        }
      }
    }
  }
  if (ans == (1LL << 62))
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
