#include <bits/stdc++.h>
using namespace std;
const long long INF(0x3f3f3f3f3f3f3f3fll);
const long long inf(0x3f3f3f3f);
template <typename T>
void read(T &res) {
  bool flag = false;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (flag = true);
  for (res = ch - 48; isdigit(ch = getchar());
       res = (res << 1) + (res << 3) + ch - 48)
    ;
  flag && (res = -res);
}
template <typename T>
void Out(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) Out(x / 10);
  putchar(x % 10 + '0');
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long pow_mod(long long x, long long n, long long mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long fact_pow(long long n, long long p) {
  long long res = 0;
  while (n) {
    n /= p;
    res += n;
  }
  return res;
}
long long mult(long long a, long long b, long long p) {
  a %= p;
  b %= p;
  long long r = 0, v = a;
  while (b) {
    if (b & 1) {
      r += v;
      if (r > p) r -= p;
    }
    v <<= 1;
    if (v > p) v -= p;
    b >>= 1;
  }
  return r;
}
long long quick_pow(long long a, long long b, long long p) {
  long long r = 1, v = a % p;
  while (b) {
    if (b & 1) r = mult(r, v, p);
    v = mult(v, v, p);
    b >>= 1;
  }
  return r;
}
bool CH(long long a, long long n, long long x, long long t) {
  long long r = quick_pow(a, x, n);
  long long z = r;
  for (long long i = 1; i <= t; i++) {
    r = mult(r, r, n);
    if (r == 1 && z != 1 && z != n - 1) return true;
    z = r;
  }
  return r != 1;
}
bool Miller_Rabin(long long n) {
  if (n < 2) return false;
  if (n == 2) return true;
  if (!(n & 1)) return false;
  long long x = n - 1, t = 0;
  while (!(x & 1)) {
    x >>= 1;
    t++;
  }
  srand(time(NULL));
  long long o = 8;
  for (long long i = 0; i < o; i++) {
    long long a = rand() % (n - 1) + 1;
    if (CH(a, n, x, t)) return false;
  }
  return true;
}
void exgcd(long long a, long long b, long long &x, long long &y) {
  if (!b) {
    x = 1, y = 0;
    return;
  }
  exgcd(b, a % b, x, y);
  long long t = x;
  x = y, y = t - (a / b) * y;
}
long long INV(long long a, long long b) {
  long long x, y;
  return exgcd(a, b, x, y), (x % b + b) % b;
}
long long crt(long long x, long long p, long long mod) {
  return INV(p / mod, mod) * (p / mod) * x;
}
long long FAC(long long x, long long a, long long b) {
  if (!x) return 1;
  long long ans = 1;
  for (long long i = 1; i <= b; i++)
    if (i % a) ans *= i, ans %= b;
  ans = pow_mod(ans, x / b, b);
  for (long long i = 1; i <= x % b; i++)
    if (i % a) ans *= i, ans %= b;
  return ans * FAC(x / a, a, b) % b;
}
long long C(long long n, long long m, long long a, long long b) {
  long long N = FAC(n, a, b), M = FAC(m, a, b), Z = FAC(n - m, a, b), sum = 0,
            i;
  for (i = n; i; i = i / a) sum += i / a;
  for (i = m; i; i = i / a) sum -= i / a;
  for (i = n - m; i; i = i / a) sum -= i / a;
  return N * pow_mod(a, sum, b) % b * INV(M, b) % b * INV(Z, b) % b;
}
long long exlucas(long long n, long long m, long long p) {
  long long t = p, ans = 0, i;
  for (i = 2; i * i <= p; i++) {
    long long k = 1;
    while (t % i == 0) {
      k *= i, t /= i;
    }
    ans += crt(C(n, m, i, k), p, k), ans %= p;
  }
  if (t > 1) ans += crt(C(n, m, t, t), p, t), ans %= p;
  return ans % p;
}
const long long N = 3e5 + 10, M = 1e4 + 10;
struct Edge {
  long long nex, to;
} edge[N << 1];
long long head[N], tot;
void add_edge(long long u, long long v) {
  edge[++tot].nex = head[u];
  edge[tot].to = v;
  head[u] = tot;
}
struct node {
  long long id, val;
  node(long long a = 0, long long b = 0) { id = a, val = b; }
};
long long n, m, g, f;
long long a[N], dp[M][1010];
long long bfs() {
  for (long long i = 0; i <= m; i++)
    for (long long j = 0; j <= g; j++) dp[i][j] = INF;
  long long ans = INF;
  deque<node> deq;
  deq.push_back(node(1, 0));
  dp[1][0] = 0;
  while (!deq.empty()) {
    node tmp = deq.front();
    deq.pop_front();
    long long id = tmp.id, val = tmp.val;
    if (!val && a[id] + g >= n && dp[id][0] != INF) {
      ans = min(ans, dp[id][0] * (g + f) + n - a[id]);
    }
    if (id > 1) {
      long long cha = a[id] - a[id - 1];
      if (!val && cha <= g && dp[id - 1][g - cha] > dp[id][0] + 1) {
        dp[id - 1][g - cha] = dp[id][0] + 1;
        deq.push_back(node(id - 1, g - cha));
      } else if (val && cha <= val && dp[id - 1][val - cha] > dp[id][val]) {
        dp[id - 1][val - cha] = dp[id][val];
        deq.push_front(node(id - 1, val - cha));
      }
    }
    if (id < m) {
      long long cha = a[id + 1] - a[id];
      if (!val && cha <= g && dp[id + 1][g - cha] > dp[id][0] + 1) {
        dp[id + 1][g - cha] = dp[id][0] + 1;
        deq.push_back(node(id + 1, g - cha));
      } else if (val && cha <= val && dp[id + 1][val - cha] > dp[id][val]) {
        dp[id + 1][val - cha] = dp[id][val];
        deq.push_front(node(id + 1, val - cha));
      }
    }
  }
  return ans;
}
signed main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) cin >> a[i];
  cin >> g >> f;
  sort(a + 1, a + 1 + m);
  long long ans = bfs();
  if (ans == INF)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
  return 0;
}
