#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  return sum * ff;
}
const long long N = 1e6 + 5;
const long long M = 1e4 + 5;
long long n, m, d[M], R, G, dis[M][1005], ans;
deque<pair<long long, long long> > q;
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= m; i++) d[i] = read();
  G = read();
  R = read();
  sort(d + 1, d + m + 1);
  memset(dis, -1, sizeof(dis));
  q.push_front(make_pair(1, 0));
  dis[1][0] = 0;
  while (!q.empty()) {
    pair<long long, long long> v = q.front();
    q.pop_front();
    if (v.first > 1) {
      long long del = d[v.first] - d[v.first - 1] + v.second;
      if (del < G) {
        if (dis[v.first - 1][del] < 0) {
          dis[v.first - 1][del] = dis[v.first][v.second];
          q.push_front(make_pair(v.first - 1, del));
        }
      }
      if (del == G) {
        if (dis[v.first - 1][0] < 0) {
          dis[v.first - 1][0] = dis[v.first][v.second] + 1;
          q.push_back(make_pair(v.first - 1, 0));
        }
      }
    }
    if (v.first < m) {
      long long del = d[v.first + 1] - d[v.first] + v.second;
      if (del < G) {
        if (dis[v.first + 1][del] < 0) {
          dis[v.first + 1][del] = dis[v.first][v.second];
          q.push_front(make_pair(v.first + 1, del));
        }
      }
      if (del == G) {
        if (dis[v.first + 1][0] < 0) {
          dis[v.first + 1][0] = dis[v.first][v.second] + 1;
          q.push_back(make_pair(v.first + 1, 0));
        }
      }
    }
  }
  long long ans = -1;
  for (long long i = 0; i < G; i++) {
    if (dis[m][i] < 0) continue;
    long long gs = dis[m][i];
    long long tim = 1ll * gs * (R + G) + i;
    if (!i && dis[m][i]) tim -= R;
    if (ans < 0 || ans > tim) ans = tim;
  }
  printf("%lld\n", ans);
  return 0;
}
