#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
using namespace std;
int dis[10005][1005];
bool mark[10005][1005];
struct tii {
  int first;
  int second;
  int th;
  tii(int x, int y, int z) : first(x), second(y), th(z) {}
  bool operator<(const tii &x) const { return first > x.first; }
};
vector<pair<int, int> > vt[10005];
priority_queue<tii> q;
void fastscan(int &number) {
  char c;
  number = 0;
  c = getchar();
  for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;
}
int main() {
  int n, m;
  fastscan(n);
  fastscan(m);
  int v[m + 5];
  for (int i = 0; i < m; i++) {
    fastscan(v[i]);
  }
  sort(v, v + m);
  int g, r;
  fastscan(g);
  fastscan(r);
  for (int i = 0; i < m - 1; i++) {
    int x = v[i];
    int y = v[i + 1];
    vt[i].push_back(make_pair(y - x, i + 1));
    vt[i + 1].push_back(make_pair(y - x, i));
  }
  q.push(tii(0ll, 0, 0));
  for (int i = 0; i < m; i++)
    for (int j = 0; j <= g + 1; j++) dis[i][j] = 1e9;
  int ans = -1;
  dis[0][0] = 0ll;
  while (q.size()) {
    int u = q.top().second;
    int ut = q.top().th;
    q.pop();
    if (mark[u][ut]) continue;
    mark[u][ut] = true;
    if (u == m - 1) {
      ans = dis[u][ut];
      break;
    }
    for (pair<int, int> x : vt[u]) {
      int v = x.second;
      int w = x.first;
      if (w + ut > g) continue;
      int d;
      if (w + ut == g) {
        if (v != m - 1)
          d = r + w + dis[u][ut];
        else
          d = w + dis[u][ut];
        if (d < dis[v][0]) {
          dis[v][0] = d;
          q.push(tii(d, v, 0));
        }
      } else {
        d = w + dis[u][ut];
        if (d < dis[v][w + ut]) {
          dis[v][w + ut] = d;
          q.push(tii(d, v, w + ut));
        }
      }
    }
  }
  printf("%d\n", ans);
  ;
  return 0;
}
