#include <bits/stdc++.h>
using namespace std;
int tav[10002][1002], t[10002], sok = 1e9 + 1;
bool v[10002][1002];
deque<pair<int, int> > q;
int m, n, mod, r, mini;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> m >> n, mini = sok;
  for (int i = 0; i < n; i++) cin >> t[i];
  sort(t, t + n);
  cin >> mod >> r;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < mod; j++) {
      tav[i][j] = sok;
    }
  }
  q.push_back({0, 0}), tav[0][0] = 0;
  while (q.size() > 0) {
    int id = q.front().first, ert = q.front().second;
    q.pop_front();
    if (!v[id][ert]) {
      v[id][ert] = 1;
      if (id != 0) {
        int ut = t[id] - t[id - 1], x = ert + ut, y = x % mod;
        if (x <= mod) {
          if (y != 0) {
            q.push_front({id - 1, y});
            tav[id - 1][y] = min(tav[id - 1][y], tav[id][ert]);
          } else {
            q.push_back({id - 1, y});
            tav[id - 1][y] = min(tav[id - 1][y], tav[id][ert] + 1);
          }
        }
      }
      if (id + 1 < n) {
        int ut = t[id + 1] - t[id], x = ert + ut, y = x % mod;
        if (x <= mod) {
          if (y != 0) {
            q.push_front({id + 1, y});
            tav[id + 1][y] = min(tav[id + 1][y], tav[id][ert]);
          } else {
            q.push_back({id + 1, y});
            tav[id + 1][y] = min(tav[id + 1][y], tav[id][ert] + 1);
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (t[n - 1] - t[i] <= mod && tav[i][0] != sok) {
      mini = min(mini, tav[i][0] * (mod + r) + t[n - 1] - t[i]);
    }
  }
  if (mini == sok) mini = -1;
  cout << mini << "\n";
  return 0;
}
