#include <bits/stdc++.h>
using namespace std;
const int sz = 1e4 + 10;
int vis[sz][1009];
int land[sz];
struct node {
  int pos, tim;
  int tot;
};
const bool operator<(const node &a, const node &b) { return a.tot > b.tot; }
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) scanf("%d", &land[i]);
  sort(land + 1, land + m + 1);
  int g, r;
  cin >> g >> r;
  int f = land[1];
  if (f > g) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < sz; i++) {
    for (int j = 0; j <= 1000; j++) vis[i][j] = (1LL << 30);
  }
  priority_queue<node> pq;
  pq.push({1, f, f});
  vis[1][f] = f;
  int ans = (1LL << 30), tot;
  int baki, lagbe, lft, rgt, rest, need, now;
  node u;
  while (!pq.empty()) {
    u = pq.top();
    pq.pop();
    if (land[u.pos] == n) {
      ans = min(ans, u.tot);
      continue;
    }
    baki = g - u.tim;
    if (baki == 0) {
      u.tot += r, u.tim = 0;
      if (vis[u.pos][u.tim] <= u.tot) continue;
      vis[u.pos][u.tim] = u.tot;
      pq.push({u.pos, u.tim, u.tot});
      continue;
    }
    lagbe = n - land[u.pos];
    if (lagbe <= baki) {
      ans = min(ans, u.tot + lagbe);
    }
    if (vis[u.pos][u.tim] < u.tot) continue;
    lft = u.pos - 1, rgt = u.pos + 1;
    if (lft >= 1) {
      rest = g - u.tim;
      need = abs(land[u.pos] - land[lft]);
      if (need <= rest) {
        now = u.tim + need;
        tot = u.tot + need;
        if (vis[lft][now] > tot) {
          vis[lft][now] = tot;
          pq.push({lft, now, tot});
        }
      }
    }
    if (rgt <= n) {
      rest = g - u.tim;
      need = abs(land[u.pos] - land[rgt]);
      if (need <= rest) {
        now = u.tim + need;
        tot = u.tot + need;
        if (vis[rgt][now] > tot) {
          vis[rgt][now] = tot;
          pq.push({rgt, now, tot});
        }
      }
    }
  }
  if (ans == (1LL << 30))
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
