#include <bits/stdc++.h>
using namespace std;
int n, m, d[10010], pos, ti, ttt, dist[10010][1010];
long long g, r, p, res;
bool vis[10010][1010];
deque<pair<int, int> > q;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> d[i];
  m += 2, d[m + 1] = n, sort(d + 1, d + m + 1);
  cin >> g >> r, p = g + r, q.push_back(make_pair(0, 0)), vis[0][0] = 1;
  res = 1e18;
  while (q.size()) {
    pos = q.front().first, ti = q.front().second, q.pop_front();
    if (ti == 0) {
      ttt = n - d[pos];
      if (ttt <= g) res = min(res, p * dist[pos][ti] + ttt);
    }
    if (ti == g) {
      if (!vis[pos][0]) {
        dist[pos][0] = dist[pos][ti] + 1;
        q.push_back(make_pair(pos, 0));
        vis[pos][0] = true;
      }
      continue;
    }
    if (pos) {
      ttt = ti + d[pos] - d[pos - 1];
      if (ttt <= g && !vis[pos - 1][ttt]) {
        vis[pos - 1][ttt] = true;
        dist[pos - 1][ttt] = dist[pos][ti];
        q.push_front(make_pair(pos - 1, ttt));
      }
    }
    if (pos < m - 1) {
      ttt = ti + d[pos + 1] - d[pos];
      if (ttt <= g && !vis[pos + 1][ttt]) {
        vis[pos + 1][ttt] = true;
        dist[pos + 1][ttt] = dist[pos][ti];
        q.push_front(make_pair(pos + 1, ttt));
      }
    }
  }
  if (res >= 1e18) res = -1;
  cout << res << endl;
  return 0;
}
