#include <bits/stdc++.h>
using namespace std;
int mod = 998244353;
const int M = 1e6 + 10;
const int N = 1e4 + 10;
inline long long read() {
  long long b = 1, sum = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') b = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return b * sum;
}
int d[N];
int n, m, k, T;
int g, r;
bool f = 0;
long long ans = 0x7fffffffffffffff;
bool vis[N][1010];
int main() {
  int i, j;
  n = read();
  m = read();
  for (i = 1; i <= m; i++) {
    d[i] = read();
  }
  g = read(), r = read();
  sort(d + 1, d + m + 1);
  vector<int> ar;
  ar.push_back(1);
  int cnt = 0;
  while (ar.size()) {
    queue<pair<int, int> > to;
    for (i = 0; i < ar.size(); i++) {
      int x = ar[i];
      if (n - d[x] <= g) {
        f = 1;
        ans = min(ans, (long long)(g + r) * cnt + n - d[x]);
      }
      to.push({x, 0});
    }
    ar.clear();
    while (to.size()) {
      int x = to.front().first;
      int cost = to.front().second;
      to.pop();
      if (x > 1) {
        int nn = d[x] - d[x - 1] + cost;
        if (nn <= g && !vis[x - 1][nn]) {
          vis[x - 1][nn] = 1;
          if (nn == g) {
            ar.push_back(x - 1);
          } else if (nn < g) {
            to.push(make_pair(x - 1, nn));
          }
        }
      }
      if (x < m) {
        int nn = d[x + 1] - d[x] + cost;
        if (nn <= g && !vis[x + 1][nn]) {
          vis[x + 1][nn] = 1;
          if (nn == g) {
            ar.push_back(x + 1);
          } else if (nn < g) {
            to.push(make_pair(x + 1, nn));
          }
        }
      }
    }
    cnt++;
  }
  if (!f)
    printf("-1");
  else
    printf("%lld", ans);
  return 0;
}
