#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
using namespace std;
const long long mod = 1e9 + 7, mod2 = 998244353;
const long double eps = 1e-6;
const long long inf = 1e18;
const int base = 1e9;
const long double PI = 3.1415926;
void deb(long double first){};
struct el {
  int d, g;
  long long sum;
  el() = default;
  el(int d, int g, long long sum) : d(d), g(g), sum(sum) {}
  bool operator<(const el &item) const { return this->sum > item.sum; }
};
int n, m, g, r;
int d[10 * 1000];
deque<el> q;
long long res = INT64_MAX;
bool u[10 * 1000][1000];
unsigned int bitcount(unsigned long long val) {
  return __builtin_popcount(val) + __builtin_popcount(val >> 32);
}
void local() { freopen("test.in", "r", stdin); }
void remote() {}
void read() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &d[i]);
  scanf("%d%d", &g, &r);
}
int main() {
  remote();
  read();
  sort(d, d + m);
  q.push_front({0, 0, 0});
  while (!q.empty()) {
    const el item = q.front();
    q.pop_front();
    if (n - d[item.d] + item.g <= g) {
      res = min(res, (long long)n - d[item.d] + item.sum);
    }
    int l = item.d > 0 ? d[item.d] - d[item.d - 1] : -1;
    if (l != -1 && l + item.g <= g && !u[item.d - 1][(item.g + l) % g]) {
      if (item.g + l == g) {
        u[item.d - 1][0] = true;
        q.push_back(el(item.d - 1, 0, item.sum + l + r));
      } else {
        u[item.d - 1][item.g + l] = true;
        q.push_front(el(item.d - 1, item.g + l, item.sum + l));
      }
    }
    int rr = item.d < m - 1 ? d[item.d + 1] - d[item.d] : -1;
    if (rr != -1 && rr + item.g <= g && !u[item.d + 1][(item.g + rr) % g]) {
      if (item.g + rr == g) {
        if (item.d == m - 2)
          q.push_back(el(item.d + 1, 0, item.sum + rr));
        else
          q.push_back(el(item.d + 1, 0, item.sum + r + rr));
        u[item.d + 1][0] = true;
      } else {
        q.push_front(el(item.d + 1, item.g + rr, item.sum + rr));
        u[item.d + 1][item.g + rr] = true;
      }
    }
  }
  cout << (res < INT64_MAX ? res : -1) << '\n';
  ;
}
