#include <bits/stdc++.h>
using namespace std;
const int maxn = 10010;
int n, a[maxn], g, r, v[maxn][1005], d[maxn][1005], len;
deque<pair<int, int> > q;
int main() {
  scanf("%d%d", &len, &n);
  for (int i(1), i_END(n); i <= i_END; i++) scanf("%d", &a[i]);
  scanf("%d%d", &g, &r);
  sort(a + 1, a + 1 + n);
  q.push_back(make_pair(1, 0));
  v[1][0] = 1;
  while (q.size()) {
    pair<int, int> tmp = q.front();
    q.pop_front();
    int x = tmp.first, y = tmp.second;
    if (x < n && a[x + 1] - a[x] + y <= g) {
      int ny = a[x + 1] - a[x] + y;
      if (v[x + 1][ny % g]) continue;
      if (ny == g)
        q.push_back(make_pair(x + 1, 0)), d[x + 1][0] = d[x][y] + 1;
      else
        q.push_front(make_pair(x + 1, ny)), d[x + 1][ny] = d[x][y];
      v[x + 1][ny % g] = 1;
    }
    if (x > 1 && a[x] - a[x - 1] + y <= g) {
      int ny = a[x] - a[x - 1] + y;
      if (v[x - 1][ny % g]) continue;
      if (ny == g)
        q.push_back(make_pair(x - 1, 0)), d[x - 1][0] = d[x][y] + 1;
      else
        q.push_front(make_pair(x - 1, ny)), d[x - 1][ny] = d[x][y];
      v[x - 1][ny % g] = 1;
    }
  }
  long long ans = 1e18;
  for (int i(1), i_END(n); i <= i_END; i++)
    if (v[i][0] && a[n] - a[i] <= g)
      ans = min(ans, 1ll * d[i][0] * (g + r) + a[n] - a[i]);
  if (ans == 1e18)
    printf("-1\n");
  else
    printf("%lld\n", ans);
  return 0;
}
