#include <bits/stdc++.h>
using namespace std;
long long int arr[11111], ans = 1e18;
bool vis[10001][1001];
struct inf {
  long long int c, x, k;
};
int main(void) {
  long long int n, m, f1, f2;
  scanf("%lld%lld", &n, &m);
  for (int e = 0; e < m; e++) scanf("%lld", &arr[e]);
  sort(arr, arr + m);
  scanf("%lld%lld", &f1, &f2);
  deque<inf> q;
  q.push_front({0, 0, 0});
  vis[0][0] = true;
  while (!q.empty()) {
    long long int c = q.front().c, now = q.front().x, k = q.front().k;
    q.pop_front();
    if (k + (n - arr[now]) <= f1) {
      ans = min(ans, c * (f1 + f2) + k + (n - arr[now]));
      continue;
    }
    if (now) {
      long long int nk = k + (arr[now] - arr[now - 1]);
      if (nk <= f1) {
        if (nk == f1 && vis[now - 1][0] == 0) {
          vis[now - 1][0] = true;
          q.push_back({c + 1, now - 1, 0});
        } else if (vis[now - 1][nk] == 0) {
          vis[now - 1][nk] = true;
          q.push_front({c, now - 1, nk});
        }
      }
    }
    if (now < m - 1) {
      long long int nk = k + (arr[now + 1] - arr[now]);
      if (nk <= f1) {
        if (nk == f1 && vis[now + 1][0] == 0) {
          vis[now + 1][0] = true;
          q.push_back({c + 1, now + 1, 0});
        } else if (vis[now + 1][nk] == 0) {
          vis[now + 1][nk] = 1;
          q.push_front({c, now + 1, nk});
        }
      }
    }
  }
  if (ans == 1e18) ans = -1;
  printf("%lld", ans);
  return 0;
}
