#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
int n, m, g, r;
vector<int> d;
vector<vector<int>> dist;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> m;
  d.resize(m);
  for (auto &elm : d) cin >> elm;
  sort(d.begin(), d.end());
  cin >> g >> r;
  dist.resize(m, vector<int>(g + 1, -1));
  dist[0][g] = 0;
  vector<pair<int, int>> q;
  q.emplace_back(0, g);
  while (!q.empty()) {
    for (int a = 0; a < q.size(); ++a) {
      int vert = q[a].first;
      int time = q[a].second;
      if (vert > 0) {
        int newTime = d[vert] - d[vert - 1];
        if (time >= newTime && dist[vert - 1][time - newTime] == -1) {
          q.emplace_back(vert - 1, time - newTime);
          dist[vert - 1][time - newTime] = dist[vert][time];
        }
      }
      if (vert < m - 1) {
        int newTime = d[vert + 1] - d[vert];
        if (time >= newTime && dist[vert + 1][time - newTime] == -1) {
          q.emplace_back(vert + 1, time - newTime);
          dist[vert + 1][time - newTime] = dist[vert][time];
        }
      }
    }
    vector<pair<int, int>> newQ;
    for (int a = 0; a < q.size(); ++a) {
      int time = q[a].second;
      if (time == 0) {
        int vert = q[a].first;
        if (dist[vert][g] == -1) {
          dist[vert][g] = dist[vert][0] + 1;
          newQ.emplace_back(vert, g);
        }
      }
    }
    swap(q, newQ);
  }
  long long ans = INF;
  for (int i = 0; i <= g; ++i) {
    if (dist[m - 1][i] != -1) {
      long long cur = (long long)dist[m - 1][i] * (g + r) + (g - i);
      ans = min(ans, cur);
    }
  }
  cout << (ans == INF ? -1 : ans) << '\n';
  return 0;
}
