#include <bits/stdc++.h>
using namespace std;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
long long inf = 1e18, MOD = 1e9 + 7;
long long n, m, stop[10005], g, r, dist[10005][1005], vis[10005][1005];
void bfs() {
  deque<pair<long long, long long>> q;
  dist[0][0] = 0;
  q.push_front(make_pair(0, 0));
  while (!q.empty()) {
    long long ver = q.front().first;
    long long cur = q.front().second;
    q.pop_front();
    if (vis[ver][cur]) continue;
    vis[ver][cur] = 1;
    if (cur == g) {
      if (!vis[ver][0] && dist[ver][0] > dist[ver][g] + 1) {
        dist[ver][0] = dist[ver][g] + 1;
        q.push_back(make_pair(ver, 0));
      }
    }
    if (ver > 0) {
      long long naya = cur + stop[ver] - stop[ver - 1];
      if (naya <= g && !vis[ver - 1][naya])
        if (dist[ver - 1][naya] > dist[ver][cur]) {
          dist[ver - 1][naya] = dist[ver][cur];
          q.push_front(make_pair(ver - 1, naya));
        }
    }
    if (ver < m - 1) {
      long long naya = cur + stop[ver + 1] - stop[ver];
      if (naya <= g && !vis[ver + 1][naya])
        if (dist[ver + 1][naya] > dist[ver][cur]) {
          dist[ver + 1][naya] = dist[ver][cur];
          q.push_front(make_pair(ver + 1, naya));
        }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int ti = 1;
  while (ti--) {
    cin >> n >> m;
    for (int i = 0; i < m; i++) cin >> stop[i];
    cin >> g >> r;
    sort(stop, stop + m);
    for (int i = 0; i < m + 1; i++)
      for (int j = 0; j < g + 1; j++) {
        dist[i][j] = inf;
      }
    bfs();
    long long ans = inf;
    for (int i = 0; i < m; i++) {
      if (n - stop[i] <= g && dist[i][0] != inf)
        ans = min(ans, dist[i][0] * (r + g) + n - stop[i]);
    }
    cout << (ans == inf ? -1ll : ans) << endl;
  }
  return 0;
}
