#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int MAX_VALUE = 1000000000;
int n, m, g, r;
int arr[10005];
int dist[10005][1005];
void bfs01() {
  deque<pair<int, int> > q;
  dist[0][0] = 0;
  q.push_back({0, 0});
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop_front();
    int v = p.first;
    int t = p.second;
    if (v > 0) {
      int newT = t + arr[v] - arr[v - 1];
      if (newT < g) {
        if (dist[v - 1][newT] == -1) {
          dist[v - 1][newT] = dist[v][t];
          q.push_front({v - 1, newT});
        }
      } else if (newT == g) {
        if (dist[v - 1][0] == -1) {
          dist[v - 1][0] = dist[v][t] + g + r;
          q.push_back({v - 1, 0});
        }
      }
    }
    if (v < m - 1) {
      int newT = t + arr[v + 1] - arr[v];
      if (newT < g) {
        if (dist[v + 1][newT] == -1) {
          dist[v + 1][newT] = dist[v][t];
          q.push_front({v + 1, newT});
        }
      } else if (newT == g) {
        if (dist[v + 1][0] == -1) {
          dist[v + 1][0] = dist[v][t] + g + r;
          q.push_back({v + 1, 0});
        }
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + m);
  cin >> g >> r;
  memset(dist, -1, sizeof(dist));
  bfs01();
  int best = MAX_VALUE;
  for (int i = 0; i < m; i++) {
    if (n - arr[i] <= g) {
      if (dist[i][0] != -1) {
        best = min(best, dist[i][0] + n - arr[i]);
      }
    }
  }
  if (best == MAX_VALUE) {
    cout << -1 << endl;
  } else {
    cout << best << endl;
  }
  return 0;
}
