#include <bits/stdc++.h>
using namespace std;
int pct(int x) { return __builtin_popcount(x); }
int pct(long long x) { return __builtin_popcountll(x); }
int bit(int x) { return 31 - __builtin_clz(x); }
int bit(long long x) { return 63 - __builtin_clzll(x); }
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
long long cdiv(long long a, long long b) {
  return a / b + !(a < 0 || a % b == 0);
}
template <typename T>
void leftShift(vector<T> &v, long long k) {
  k %= (int)v.size();
  if (k < 0) k += (int)v.size();
  rotate(v.begin(), v.begin() + k, v.end());
}
template <typename T>
void rightSift(vector<T> &v, long long k) {
  leftShift(v, (int)v.size() - k);
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand(long long l, long long r) {
  uniform_int_distribution<long long> uid(l, r);
  return uid(rng);
}
inline int nxt() {
  int x;
  cin >> x;
  return x;
}
inline long long nxtll() {
  long long x;
  cin >> x;
  return x;
}
void pr() {}
void sc() {}
template <typename Head, typename... Tail>
void pr(Head H, Tail... T) {
  cout << H << " ";
  pr(T...);
}
template <typename Head, typename... Tail>
void sc(Head &H, Tail &...T) {
  cin >> H;
  sc(T...);
}
string to_string(__int128 x) {
  string s = "";
  bool neg = 0;
  if (x < 0) {
    s += "-";
    neg = 1;
    x = -x;
  }
  if (!x) s += '0';
  while (x) {
    int rem = x % 10;
    s += to_string(rem);
    x /= 10;
  }
  reverse(s.begin() + neg, s.end());
  return s;
}
const int mod = 1e9 + 7;
int pwr(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * 1LL * a) % mod;
    a = (a * 1LL * a) % mod;
    b >>= 1;
  }
  return ans;
}
const int M = 1e4 + 5;
long long dp[M][1005];
int d[M];
void solve() {
  int n, m;
  sc(n, m);
  for (int i = 1; i <= m; i++) {
    sc(d[i]);
  }
  int g, r;
  sc(g, r);
  sort(d + 1, d + m + 1);
  for (int i = 1; i <= m; i++) {
    for (int j = 0; j <= g; j++) {
      dp[i][j] = 1e18;
    }
  }
  dp[1][g] = 0;
  deque<pair<int, int> > q;
  q.push_back({1, g});
  long long ans = 1e18;
  bool bb = 0;
  if (g > r) bb = 1;
  while (!q.empty()) {
    pair<int, int> u = q.front();
    q.pop_front();
    if (u.first == m) {
      ans = min(ans, dp[u.first][u.second]);
    }
    if (u.first > 1) {
      int dd = abs(d[u.first - 1] - d[u.first]);
      if (dd <= u.second &&
          dp[u.first - 1][u.second - dd] > dp[u.first][u.second] + dd) {
        dp[u.first - 1][u.second - dd] = dp[u.first][u.second] + dd;
        if (bb)
          q.push_back({u.first - 1, u.second - dd});
        else
          q.push_front({u.first - 1, u.second - dd});
      }
    }
    if (u.first < m) {
      int dd = abs(d[u.first + 1] - d[u.first]);
      if (dd <= u.second &&
          dp[u.first + 1][u.second - dd] > dp[u.first][u.second] + dd) {
        dp[u.first + 1][u.second - dd] = dp[u.first][u.second] + dd;
        if (bb)
          q.push_back({u.first + 1, u.second - dd});
        else
          q.push_front({u.first + 1, u.second - dd});
      }
    }
    if (u.second == 0 && dp[u.first][g] > dp[u.first][u.second] + r) {
      dp[u.first][g] = dp[u.first][u.second] + r;
      if (!bb)
        q.push_back({u.first, g});
      else
        q.push_front({u.first, g});
    }
  }
  if (ans == 1e18) ans = -1;
  cout << ans;
}
signed main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  for (int tt = 1; tt <= t; tt++) {
    solve();
  }
  return 0;
}
