#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize(2)
const int inf = 0x3f3f3f3f;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, m, g, r, d[10010], dis[10010][1010];
long long ans;
deque<pair<int, int> > q;
int main() {
  n = read(), m = read(), ans = 1LL * inf * inf;
  for (int i = 1; i <= m; ++i) {
    d[i] = read();
  }
  g = read(), r = read();
  sort(d + 1, d + m + 1);
  q.push_back(make_pair(1, 0));
  memset(dis, 0x3f, sizeof(dis));
  dis[1][0] = 0;
  while (!q.empty()) {
    int u = q.front().first, t = q.front().second;
    q.pop_front();
    if (t + n - d[u] <= g) {
      ans = min(ans, 1LL * dis[u][t] * (g + r) + t + n - d[u]);
    }
    for (int i = u + 1; i <= min(u + 1, m); ++i) {
      int p = t + d[i] - d[u];
      if (p > g) break;
      if (p == g && dis[i][0] == inf) {
        dis[i][0] = dis[u][t] + 1;
        q.push_back(make_pair(i, 0));
      } else if (dis[i][p] == inf) {
        dis[i][p] = dis[u][t];
        q.push_front(make_pair(i, p));
      }
    }
    for (int i = u - 1; i >= max(u - 1, 1); --i) {
      int p = t + d[u] - d[i];
      if (p > g) break;
      if (p == g && dis[i][0] == inf) {
        dis[i][0] = dis[u][t] + 1;
        q.push_back(make_pair(i, 0));
      } else if (dis[i][p] == inf) {
        dis[i][p] = dis[u][t];
        q.push_front(make_pair(i, p));
      }
    }
  }
  if (ans == 1LL * inf * inf) {
    printf("-1\n");
  } else {
    printf("%I64d\n", ans);
  }
  return 0;
}
