#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n, m, t, a[100005], x, y, ans;
int dis[10005][1005], vis[10005][1005];
deque<pair<int, int> > q;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d %d", &x, &y);
  y += x;
  sort(a + 1, a + m + 1);
  ans = 0x3f3f3f3f;
  q.push_back(make_pair(1, 0));
  vis[1][0] = 1;
  while (q.size()) {
    int u = q.front().first;
    int v = q.front().second;
    q.pop_front();
    if (v == 0) {
      int w = n - a[u];
      if (w <= x) {
        ans = min(ans, dis[u][v] * y + w);
      }
    }
    if (v == x) {
      if (vis[u][0] == 0) {
        dis[u][0] = dis[u][v] + 1;
        vis[u][0] = 1;
        q.push_back(make_pair(u, 0));
      }
      continue;
    }
    if (u >= 2) {
      int w = v + a[u] - a[u - 1];
      if (w <= x && vis[u - 1][w] == 0) {
        dis[u - 1][w] = dis[u][v];
        vis[u - 1][w] = 1;
        q.push_front(make_pair(u - 1, w));
      }
    }
    if (u <= m - 1) {
      int w = v + a[u + 1] - a[u];
      if (w <= x && vis[u + 1][w] == 0) {
        dis[u + 1][w] = dis[u][v];
        vis[u + 1][w] = 1;
        q.push_front(make_pair(u + 1, w));
      }
    }
  }
  printf("%d", ans == 0x3f3f3f3f ? -1 : ans);
  return 0;
}
