#include <bits/stdc++.h>
using namespace std;
int N, M, vals[10010];
queue<int> Q[10010];
long long G, R, ans = 0x7F7F7F7F;
bool vis[10010][1010];
void dfs(int curr, int id, int tim) {
  if (tim < 0 || vis[id][tim]) return;
  if (id == M) {
    ans = min(ans, curr * (R + G) + (G - tim));
    return;
  }
  vis[id][tim] = true;
  if (tim == 0) Q[curr + 1].push(id);
  if (id <= M - 1) dfs(curr, id + 1, tim - (vals[id + 1] - vals[id]));
  if (id >= 2) dfs(curr, id - 1, tim - (vals[id] - vals[id - 1]));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> M;
  for (int i = 0; i < M; i++) cin >> vals[i + 1];
  cin >> G >> R;
  sort(vals + 1, vals + M + 1);
  Q[0].push(1);
  for (int i = 0; i < 10010; i++) {
    while (!Q[i].empty()) {
      dfs(i, Q[i].front(), G);
      Q[i].pop();
    }
  }
  if (ans == 0x7F7F7F7F)
    cout << "-1\n";
  else
    cout << ans << "\n";
  return 0;
}
