#include <bits/stdc++.h>
using namespace std;
const int maxn = 10010;
const long long inf = 0x3f3f3f3f3f3f3f3f;
int n, m, tot, head[maxn], d[maxn], g, r;
long long ans, dis[maxn][maxn / 10];
deque<pair<int, int> > q;
int main() {
  int i;
  cin >> n >> m;
  for (i = 1; i <= m; i++) cin >> d[i];
  sort(d + 1, d + m + 1);
  cin >> g >> r;
  memset(dis, 0x3f, sizeof(dis));
  dis[1][g] = 0;
  q.push_back(make_pair(1, g));
  while (!q.empty()) {
    int u = q.front().first, w = q.front().second;
    q.pop_front();
    if (u > 1) {
      int x = d[u] - d[u - 1];
      if (x < w) {
        if (dis[u - 1][w - x] > dis[u][w]) {
          dis[u - 1][w - x] = dis[u][w];
          q.push_front(make_pair(u - 1, w - x));
        }
      } else if (x == w) {
        if (dis[u - 1][g] > dis[u][w] + 1) {
          dis[u - 1][g] = dis[u][w] + 1;
          q.push_back(make_pair(u - 1, g));
        }
      }
    }
    if (u < m) {
      int x = d[u + 1] - d[u];
      if (x < w) {
        if (dis[u + 1][w - x] > dis[u][w]) {
          dis[u + 1][w - x] = dis[u][w];
          q.push_front(make_pair(u + 1, w - x));
        }
      } else if (x == w) {
        if (dis[u + 1][g] > dis[u][w] + 1) {
          dis[u + 1][g] = dis[u][w] + 1;
          q.push_back(make_pair(u + 1, g));
        }
      }
    }
  }
  ans = inf;
  for (i = 1; i <= m; i++)
    if (n - d[i] <= g && dis[i][g] < inf)
      ans = min(ans, 1ll * dis[i][g] * (g + r) + n - d[i]);
  if (ans < inf)
    printf("%lld\n", ans);
  else
    puts("-1");
  return 0;
}
