#include <bits/stdc++.h>
using namespace std;
int used[10001][1001];
int dis[10001][1001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int a[m];
  for (int i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  int g, r;
  cin >> g >> r;
  deque<pair<int, int> > q;
  long long ans = -1;
  q.push_back(make_pair(0, 0));
  while (!q.empty()) {
    int v = q.front().first;
    int t = q.front().second;
    q.pop_front();
    if (t == 0) {
      int tto = n - a[v];
      if (tto <= g &&
          (ans == -1 || ans > 1ll * (r + g) * dis[v][0] + 1ll * tto))
        ans = 1ll * (r + g) * dis[v][0] + 1ll * tto;
    }
    if (t == g) {
      if (!used[v][0]) {
        used[v][0] = 1;
        dis[v][0] = dis[v][t] + 1;
        q.push_back(make_pair(v, 0));
      }
      continue;
    }
    if (v) {
      int tto = a[v] - a[v - 1];
      if (t + tto <= g && used[v - 1][t + tto] == 0) {
        used[v - 1][t + tto] = 1;
        dis[v - 1][t + tto] = dis[v][t];
        q.push_front(make_pair(v - 1, t + tto));
      }
    }
    if (v < m - 1) {
      int tto = a[v + 1] - a[v];
      if (t + tto <= g && used[v + 1][t + tto] == 0) {
        used[v + 1][t + tto] = 1;
        dis[v + 1][t + tto] = dis[v][t];
        q.push_front(make_pair(v + 1, t + tto));
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
