#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater() {}
void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\'' << x << '\''; }
void __print(const char *x) { cout << '\"' << x << '\"'; }
void __print(const string &x) { cout << '\"' << x << '\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cout << '{';
  __print(x.first);
  cout << ',';
  __print(x.second);
  cout << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cout << '{';
  for (auto &i : x) cout << (f++ ? "," : ""), __print(i);
  cout << "}";
}
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
long long p = 1e9 + 7;
const int N = 2e5 + 5;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int T = 1;
  while (T--) {
    int n, m;
    cin >> n >> m;
    int a[m];
    for (int i = 0; i < (m); ++i) cin >> a[i];
    sort(a, a + m);
    int g, r;
    cin >> g >> r;
    deque<pair<int, int> > dq;
    dq.push_back(make_pair(0, 0));
    int cost[m][g];
    int visit[m][g];
    memset(visit, 0, sizeof(visit));
    memset(cost, 0x3f, sizeof(cost));
    cost[0][0] = 0;
    int ans = INT_MAX;
    while (!dq.empty()) {
      int i = dq.front().first;
      int t = dq.front().second;
      dq.pop_front();
      if (visit[i][t] == 1) continue;
      visit[i][t] = 1;
      if (i == (m - 1)) {
        int tt = t;
        if (t == 0) tt = g;
        ans = min(ans, tt + cost[i][t] * (r + g));
      }
      if (i > 0) {
        int tt = t + a[i] - a[i - 1];
        if (tt <= g) {
          if (tt == g) tt = 0;
          int z = 0;
          if (t == 0 && i != 0) z = 1;
          if (cost[i - 1][tt] > (cost[i][t] + z)) {
            cost[i - 1][tt] = cost[i][t] + z;
            if (z == 0)
              dq.push_front({i - 1, tt});
            else
              dq.push_back({i - 1, tt});
          }
        }
      }
      if (i < m - 1) {
        int tt = t + a[i + 1] - a[i];
        if (tt <= g) {
          if (tt == g) tt = 0;
          int z = 0;
          if (t == 0 && i != 0) z = 1;
          if (cost[i + 1][tt] > (cost[i][t] + z)) {
            cost[i + 1][tt] = cost[i][t] + z;
            if (z == 0)
              dq.push_front({i + 1, tt});
            else
              dq.push_back({i + 1, tt});
          }
        }
      }
    }
    if (ans == INT_MAX) ans = -1;
    cout << ans;
  }
  timecalculater();
  return 0;
}
