#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const int sz = 1e4 + 2;
int dist[sz][1002], n, m, g, r;
bitset<1002> exist[sz];
int land[sz];
struct node {
  int pos, tim, tot;
};
const bool operator<(const node &a, const node &b) { return a.tot > b.tot; }
inline void read_int(int &x) {
  x = 0;
  register char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar())
    x = (x << 3) + (x << 1) + (c - '0');
}
int spfa() {
  int f = land[1];
  if (f > g) return (1LL << 30);
  for (int i = 0; i < sz; i++) {
    for (int j = 0; j <= 1000; j++) dist[i][j] = (1LL << 30);
  }
  priority_queue<node> q;
  q.push({1, f, f});
  dist[1][f] = f, exist[1][f] = true;
  int ans = (1LL << 30), tot;
  int baki, lagbe, lft, rgt, rest, need, now;
  node u;
  while (!q.empty()) {
    u = q.top();
    q.pop();
    exist[u.pos][u.tim] = false;
    if (land[u.pos] == n) {
      ans = min(ans, dist[u.pos][u.tim]);
      continue;
    }
    baki = g - u.tim;
    if (baki == 0) {
      now = 0;
      if (dist[u.pos][now] > dist[u.pos][u.tim] + r) {
        dist[u.pos][now] = dist[u.pos][u.tim] + r;
        if (!exist[u.pos][now]) {
          q.push({u.pos, now, dist[u.pos][now]});
          exist[u.pos][now] = true;
        }
      }
      continue;
    }
    lagbe = n - land[u.pos];
    if (lagbe <= baki) ans = min(ans, dist[u.pos][u.tim] + lagbe);
    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 = dist[u.pos][u.tim] + need;
        if (dist[lft][now] > tot) {
          dist[lft][now] = tot;
          if (!exist[lft][now]) {
            q.push({lft, now, dist[lft][now]});
            exist[lft][now] = true;
          }
        }
      }
    }
    if (rgt <= n) {
      rest = g - u.tim;
      need = abs(land[u.pos] - land[rgt]);
      if (need <= rest) {
        now = u.tim + need;
        tot = dist[u.pos][u.tim] + need;
        if (dist[rgt][now] > tot) {
          dist[rgt][now] = tot;
          if (!exist[rgt][now]) {
            q.push({rgt, now, dist[rgt][now]});
            exist[rgt][now] = true;
          }
        }
      }
    }
  }
  return ans;
}
int main() {
  read_int(n), read_int(m);
  for (int i = 1; i <= m; i++) read_int(land[i]);
  sort(land + 1, land + m + 1);
  read_int(g), read_int(r);
  int ans = spfa();
  if (ans == (1LL << 30))
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
