#include <bits/stdc++.h>
using namespace std;
int n, m;
long long g, r;
int a[10005];
deque<pair<int, int> > q;
int dp[10005][1005];
int main() {
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  scanf("%lld%lld", &g, &r);
  sort(a + 1, a + m + 1);
  dp[1][0] = 0;
  q.push_front(make_pair(1, 0));
  while (q.empty() == false) {
    pair<int, int> p = q.front();
    q.pop_front();
    int f = p.first, s = p.second;
    if (p.first > 1) {
      int emm = a[f] - a[f - 1] + s;
      if (emm < g) {
        if (dp[f - 1][emm] == 0x3f3f3f3f) {
          dp[f - 1][emm] = dp[f][s];
          q.push_front(make_pair(f - 1, emm));
        }
      } else if (emm == g) {
        if (dp[f - 1][0] == 0x3f3f3f3f) {
          dp[f - 1][0] = dp[f][s] + 1;
          q.push_back(make_pair(f - 1, 0));
        }
      }
    }
    if (p.first < m) {
      int emm = a[f + 1] - a[f] + s;
      if (emm < g) {
        if (dp[f + 1][emm] == 0x3f3f3f3f) {
          dp[f + 1][emm] = dp[f][s];
          q.push_front(make_pair(f + 1, emm));
        }
      } else if (emm == g) {
        if (dp[f + 1][0] == 0x3f3f3f3f) {
          dp[f + 1][0] = dp[f][s] + 1;
          q.push_back(make_pair(f + 1, 0));
        }
      }
    }
  }
  long long ans = 0x3f3f3f3f3f3f3f3f;
  for (int i = 0; i <= g - 1; i++) {
    if (dp[m][i] != 0x3f3f3f3f) {
      ans = min(1ll * dp[m][i] * (g + r) + i, ans);
      if (i == 0 && dp[m][i] > 0)
        ans = min(1ll * dp[m][i] * (g + r) + i - r, ans);
    }
  }
  if (ans == 0x3f3f3f3f3f3f3f3f)
    printf("-1\n");
  else
    printf("%lld\n", ans);
  return 0;
}
