#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 10;
const int INF = 2e9;
int n, m, a[maxn], g, r, dis[maxn][1010], ans = INF;
bool vis[maxn][1010];
struct node {
  int first, second, t;
  node(int a = 0, int b = 0, int c = 0) {
    first = a;
    second = b;
    t = c;
  }
  bool operator<(const node &a) const { return t > a.t; }
};
priority_queue<node> Q;
signed main() {
  scanf("%d%d", &n, &m);
  for (int i = (1), _end_ = (m); i <= _end_; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + m + 1);
  scanf("%d%d", &g, &r);
  for (int i = (1), _end_ = (m); i <= _end_; ++i)
    for (int j = (0), _end_ = (g); j <= _end_; ++j) dis[i][j] = INF;
  dis[1][0] = 0;
  Q.push(node(1, 0, 0));
  while (!Q.empty()) {
    node t = Q.top();
    Q.pop();
    int first = t.first, second = t.second;
    if (vis[first][second]) continue;
    vis[first][second] = true;
    if (first == m) {
      printf("%d\n", dis[first][second]);
      return 0;
    }
    if (t.second == g) {
      if (dis[t.first][0] > dis[t.first][t.second] + r) {
        dis[t.first][0] = dis[t.first][t.second] + r;
        Q.push(node(first, 0, dis[first][second] + r));
      }
    }
    if (t.first < m) {
      int s = a[first + 1] - a[first];
      if (s + second <= g &&
          dis[first + 1][second + s] > dis[first][second] + s) {
        dis[first + 1][second + s] = dis[first][second] + s;
        Q.push(node(first + 1, second + s, dis[first][second] + s));
      }
    }
    if (t.first > 1) {
      int s = a[first] - a[first - 1];
      if (s + second <= g &&
          dis[first - 1][second + s] > dis[first][second] + s) {
        dis[first - 1][second + s] = dis[first][second] + s;
        Q.push(node(first - 1, second + s, dis[first][second] + s));
      }
    }
  }
  puts("-1");
  return 0;
}
