#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 322;
int dp[10010][1010];
int arr[10010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> arr[i];
  }
  int g, r;
  cin >> g >> r;
  sort(arr, arr + m);
  deque<pair<int, pair<int, int> > > pq;
  pq.push_front({0, {0, 0}});
  int dist;
  int indx, green;
  bool flag = true;
  while (!pq.empty()) {
    dist = pq.front().first;
    indx = pq.front().second.first;
    green = pq.front().second.second;
    pq.pop_front();
    if (dp[indx][green] != 0 && dist >= dp[indx][green]) continue;
    flag = dist < dp[indx][green];
    dp[indx][green] = dist;
    if (green == g) {
      dist += r;
      green = 0;
    }
    if ((indx < (m - 1)) && (green - arr[indx] + arr[indx + 1]) <= g) {
      if (flag)
        pq.push_front({dist + arr[indx + 1] - arr[indx],
                       {indx + 1, (green - arr[indx] + arr[indx + 1])}});
      else
        pq.push_back({dist + arr[indx + 1] - arr[indx],
                      {indx + 1, (green - arr[indx] + arr[indx + 1])}});
    }
    if ((indx > 0) && (green + arr[indx] - arr[indx - 1]) <= g) {
      if (flag)
        pq.push_front({dist + arr[indx] - arr[indx - 1],
                       {indx - 1, (green + arr[indx] - arr[indx - 1])}});
      else
        pq.push_back({dist + arr[indx] - arr[indx - 1],
                      {indx - 1, (green + arr[indx] - arr[indx - 1])}});
    }
  }
  int ans = 0;
  for (int i = 0; i < 1010; i++) {
    if (dp[m - 1][i] != 0) {
      ans = (ans == 0 ? dp[m - 1][i] : min(ans, dp[m - 1][i]));
    }
  }
  cout << (ans == 0 ? -1 : ans) << endl;
  return 0;
}
