#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int m;
bool vis[10 * N][N];
int a[10 * N];
long long g, r;
long long INF = 1e18;
long long bfs() {
  deque<pair<pair<int, int>, long long> > dq;
  dq.push_back({{0, g}, 0});
  long long ans = INF;
  while (!dq.empty()) {
    int u = dq.front().first.first, rem = dq.front().first.second;
    long long d = dq.front().second;
    dq.pop_front();
    if (u == m - 1) ans = min(ans, d + g - rem);
    if (vis[u][rem]) continue;
    vis[u][rem] = 1;
    if (rem == 0) dq.push_back({{u, g}, g + d + r});
    for (int i = -1; i <= 1; i++)
      if (u + i >= 0 && u + i < m && i != 0) {
        int v = u + i;
        if (abs(a[u] - a[v]) <= rem)
          dq.push_front({{v, rem - abs(a[u] - a[v])}, d});
      }
  }
  if (ans == INF) ans = -1;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  cin >> g >> r;
  sort(a, a + m);
  cout << bfs() << endl;
  return 0;
}
