#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long fast(long long x, long long n) {
  long long ans = 1;
  for (; n; n >>= 1, x = x * x % mod)
    if (n & 1) ans = ans * x % mod;
  return ans;
}
const long long N = 1e7 + 100;
struct node {
  long long d, pos, v;
};
long long vis[10001][1001];
deque<node> q;
long long a[N];
int main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    scanf("%lld", &a[i]);
  }
  sort(a + 1, a + 1 + m);
  long long g, r;
  cin >> g >> r;
  q.push_front({0, 1, 0});
  memset(vis, -1, sizeof vis);
  node u;
  node v;
  long long ans = 1e18;
  while (!q.empty()) {
    u = q.front();
    q.pop_front();
    if (vis[u.pos][u.d] != -1) continue;
    vis[u.pos][u.d] = u.v;
    if (u.d == g) q.push_back({0, u.pos, u.v + 1});
    if (u.pos - 1 >= 1 && u.d + a[u.pos] - a[u.pos - 1] <= g)
      q.push_front({u.d + a[u.pos] - a[u.pos - 1], u.pos - 1, u.v});
    if (u.pos + 1 <= m && u.d + a[u.pos + 1] - a[u.pos] <= g)
      q.push_front({u.d + a[u.pos + 1] - a[u.pos], u.pos + 1, u.v});
  }
  for (int i = 0; i <= g; i++)
    if (vis[m][i] != -1) ans = min(ans, (g + r) * vis[m][i] + i);
  if (ans != 1e18)
    cout << ans;
  else
    cout << "-1";
}
