#include <bits/stdc++.h>
using namespace std;
void Start() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); }
bool endline = false;
bool endlineA = false;
template <class T>
istream& operator>>(istream& in, vector<T>& v) {
  for (auto& i : v) {
    in >> i;
  }
  return in;
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (auto i : v) {
    out << i;
    if (!endline) {
      out << ' ';
    } else {
      out << '\n';
    }
  }
  if (!endline && endlineA) {
    out << '\n';
  }
  return out;
}
template <class T, class U>
istream& operator>>(istream& in, pair<T, U>& p) {
  in >> p.first >> p.second;
  return in;
}
template <class T, class U>
ostream& operator<<(ostream& out, const pair<T, U>& p) {
  out << p.first << ' ' << p.second;
  return out;
}
long long gettime() {
  return chrono::high_resolution_clock::now().time_since_epoch().count() /
         1000000;
}
mt19937 getrand(
    chrono::high_resolution_clock::now().time_since_epoch().count());
long long randnum(long long l, long long r) {
  return l + getrand() % (r - l + 1);
}
const int M = 10005;
const int N = 1005;
int d[M][N];
signed main() {
  Start();
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  cin >> x;
  sort(x.begin(), x.end());
  int a, b;
  cin >> a >> b;
  for (int i = 0; i < (m - 1); i++) {
    if (x[i + 1] - x[i] > a) {
      cout << -1;
      return 0;
    }
  }
  for (int i = 0; i < (m); i++) {
    for (int j = 0; j < (a); j++) {
      d[i][j] = 1e9;
    }
  }
  d[0][0] = 0;
  deque<int> s;
  s.push_front(0);
  while (!s.empty()) {
    auto temp = s.front();
    pair<int, int> v;
    v.first = (temp >> 10);
    v.second = (temp & 1023);
    s.pop_front();
    if (v.first > 0) {
      int dt = x[v.first] - x[v.first - 1];
      int tm = v.second + dt;
      bool t = false;
      if (tm == a) {
        dt += b;
        tm = 0;
        t = true;
      }
      if (tm < a && d[v.first - 1][tm] > d[v.first][v.second] + dt) {
        d[v.first - 1][tm] = d[v.first][v.second] + dt;
        if (!t)
          s.push_front(((v.first - 1) << 10) + tm);
        else
          s.push_back(((v.first - 1) << 10) + tm);
      }
    }
    if (v.first < m - 1) {
      int dt = x[v.first + 1] - x[v.first];
      int tm = v.second + dt;
      bool t = false;
      if (tm == a) {
        dt += b;
        tm = 0;
        t = true;
      }
      if (tm < a && d[v.first + 1][tm] > d[v.first][v.second] + dt) {
        d[v.first + 1][tm] = d[v.first][v.second] + dt;
        if (!t)
          s.push_front(((v.first + 1) << 10) + tm);
        else
          s.push_back(((v.first + 1) << 10) + tm);
      }
    }
  }
  int ans = 1e9;
  for (int i = 0; i < (a); i++) {
    if (i == 0) {
      if (d[m - 1][i] != 1e9) {
        ans = d[m - 1][i] - b;
      }
    } else {
      ans = min(ans, d[m - 1][i]);
    }
  }
  cout << ((ans == 1e9) ? -1 : ans);
  return 0;
}
