#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
const int MOD = 1e+9 + 7;
const int INF = INT_MAX;
const int N = 2e+5 + 8;
vector<int> adj[N];
int vis[N];
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
int test_cases = 1;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
;
int n, m, g, r, d[N], dp[10008][1008];
void MAIN(int tc) {
  cin >> n >> m;
  for (int i = (1); i <= m; i++) cin >> d[i];
  ;
  sort(1 + d, d + m + 1);
  cin >> g >> r;
  for (int i = (0); i <= m + 1; i++) {
    for (int j = (0); j <= g + 1; j++) {
      dp[i][j] = INF;
    }
  }
  deque<pair<int, int> > q;
  dp[1][0] = 0;
  q.push_back({1, 0});
  while (q.size() != 0) {
    pair<int, int> p = q.front();
    q.pop_front();
    int v = p.first, st = p.second;
    for (int t : {-1, +1}) {
      int to = v + t;
      int dist = abs(d[v] - d[to]);
      int nst = st + dist;
      int w = 0;
      if (1 <= to && to <= m) {
        if (nst > g) continue;
        if (nst == g) nst = 0, w = r;
        if (to == m) w = 0;
        if (dp[to][nst] == INF) {
          dp[to][nst] = dp[v][st] + dist + w;
          if (nst == 0)
            q.push_back({to, nst});
          else
            q.push_front({to, nst});
        }
      }
    }
  }
  int res = INF;
  for (int j = (0); j <= g - 1; j++) res = min(res, dp[m][j]);
  if (res == INF) res = -1;
  cout << res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  ;
  for (int i = (1); i <= test_cases; i++) {
    MAIN(i);
  }
}
