#include <bits/stdc++.h>
using namespace std;
void dbg() { std::cout << "  #\n"; }
template <typename T, typename... Args>
void dbg(T a, Args... args) {
  std::cout << a << ' ';
  dbg(args...);
}
const long long maxn = 1e4 + 10;
const long long MAX = 1e3 + 10;
const long long inf = 1e17;
const long long mod = 1e9 + 7;
long long n, m;
long long g, r;
long long a[maxn];
bool vis[maxn][MAX];
long long f[maxn][MAX];
long long ans = inf;
void solve() {
  cin >> n >> m;
  for (long long i = (1); i <= (m); ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + m);
  cin >> g >> r;
  deque<pair<long long, long long> > q;
  q.push_front(make_pair(0, 0));
  vis[0][0] = 1;
  while (!q.empty()) {
    long long pos = q.front().first;
    long long num = q.front().second;
    q.pop_front();
    if (num == 0) {
      if (n - a[pos] <= g) {
        ans = min(ans, n - a[pos] + f[pos][0] * (r + g));
      }
    } else if (num == g) {
      if (vis[pos][0] == 0) {
        f[pos][0] = f[pos][num] + 1;
        vis[pos][0] = 1;
        q.push_back(make_pair(pos, 0));
      }
      continue;
    }
    if (pos > 1) {
      long long next_pos = pos - 1;
      long long next_num = num + a[pos] - a[next_pos];
      if (next_num <= g && vis[next_pos][next_num] == 0) {
        f[next_pos][next_num] = f[pos][num];
        vis[next_pos][next_num] = 1;
        q.push_front(make_pair(next_pos, next_num));
      }
    }
    if (pos < m) {
      long long next_pos = pos + 1;
      long long next_num = num + a[next_pos] - a[pos];
      if (next_num <= g && vis[next_pos][next_num] == 0) {
        f[next_pos][next_num] = f[pos][num];
        vis[next_pos][next_num] = 1;
        q.push_front(make_pair(next_pos, next_num));
      }
    }
  }
  if (ans == inf) ans = -1;
  cout << (ans) << '\n';
}
signed main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long T = 1;
  while (T--) {
    solve();
  }
}
