#include <bits/stdc++.h>
const int Nmax = 10005;
const int Mmax = 1005;
const int Mod = 1e9 + 7;
using namespace std;
int n, m, r, g;
int v[Nmax];
int dis[Nmax][Mmax];
deque<pair<int, pair<int, int> > > q;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> v[i];
  }
  sort(v, v + m);
  cin >> g >> r;
  q.push_front({0, {0, 1}});
  while (!q.empty()) {
    int i = q.front().first;
    int mod = q.front().second.first;
    int d = q.front().second.second;
    q.pop_front();
    if (dis[i][mod] != 0) {
      continue;
    }
    dis[i][mod] = d;
    if (i - 1 >= 0) {
      int dd = v[i] - v[i - 1];
      if (mod + dd < g) {
        q.push_front({i - 1, {mod + dd, d}});
      }
      if (mod + dd == g) {
        q.push_back({i - 1, {0, d + 1}});
      }
    }
    if (i + 1 < m) {
      int dd = v[i + 1] - v[i];
      if (mod + dd < g) {
        q.push_front({i + 1, {mod + dd, d}});
      }
      if (mod + dd == g) {
        q.push_back({i + 1, {0, d + 1}});
      }
    }
  }
  long long int ans = 1e18;
  for (int i = 0; i < m; ++i) {
    if (dis[i][0] && n - v[i] <= g) {
      ans = min(ans, (dis[i][0] - 1LL) * (g + r) + n - v[i]);
    }
  }
  cout << (ans < 1e17 ? ans : -1) << "\n";
  return 0;
}
