#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 100;
const int INF = 0x3f3f3f3f;
const int mod = 998244353;
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
long long qpow(long long p, long long q) {
  return (q & 1 ? p : 1) * (q ? qpow(p * p % mod, q / 2) : 1) % mod;
}
struct node {
  int pos, step;
};
int n, m, r, g, a[maxn];
struct _01bfs {
  deque<node> q;
  int dis[maxn][1010];
  long long ans, tmp;
  bool vis[maxn][1010];
  node now;
  bool flag;
  void init() {
    memset(dis, 0x3f, sizeof(dis));
    ans = INF;
    q.clear();
  }
  int bfs() {
    q.push_back({0, 0});
    dis[0][0] = 0;
    while (!q.empty()) {
      now = q.front();
      q.pop_front();
      if (now.step == 0) {
        int rem = n - a[now.pos];
        if (rem <= g) {
          tmp = 1ll * dis[now.pos][now.step] * (g + r) + rem;
          ans = min(ans, tmp);
        }
      }
      if (now.step == g) {
        if (dis[now.pos][0] > dis[now.pos][now.step] + 1) {
          dis[now.pos][0] = dis[now.pos][now.step] + 1;
          q.push_back({now.pos, 0});
        }
        continue;
      }
      if (now.pos > 1) {
        int p = now.pos - 1;
        int v = now.step + a[now.pos] - a[p];
        if (v <= g && dis[p][v] > dis[now.pos][now.step]) {
          dis[p][v] = dis[now.pos][now.step];
          q.push_front({p, v});
        }
      }
      if (now.pos < m) {
        int p = now.pos + 1;
        int v = now.step + a[p] - a[now.pos];
        if (v <= g && dis[p][v] > dis[now.pos][now.step]) {
          dis[p][v] = dis[now.pos][now.step];
          q.push_front({p, v});
        }
      }
    }
    return (ans == INF) ? (-1) : ans;
  }
} hehehe;
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) a[i] = read();
  g = read(), r = read();
  sort(a + 1, a + 1 + m);
  hehehe.init();
  cout << hehehe.bfs() << endl;
  return 0;
}
