#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
const long long MOD1 = 2286661337;
const long long MOD2 = 998244353;
const int INF = (int)1e9 + 7;
const double EPS = 1e-7;
const int N = (int)1e4;
const int G = (int)1e3;
int n, m, d[N], g, r, dist[N][G];
pair<int, int> neib[N];
void bfs() {
  deque<pair<int, pair<int, int>>> q;
  q.push_back(make_pair(0, make_pair(0, 0)));
  dist[0][0] = 0;
  while (q.size()) {
    auto h = q.front();
    pair<int, int> cur = h.second;
    q.pop_front();
    if (h.first != dist[cur.first][cur.second]) {
      continue;
    }
    int d_ = (cur.second == 0);
    int r_ = cur.second;
    if (r_ == 0) {
      r_ = g;
    }
    if (neib[cur.first].first != -1) {
      int new_r = r_ - neib[cur.first].first;
      if (new_r >= 0) {
        if (dist[cur.first - 1][new_r] > dist[cur.first][cur.second] + d_) {
          dist[cur.first - 1][new_r] = dist[cur.first][cur.second] + d_;
          if (d_) {
            q.push_back(make_pair(dist[cur.first - 1][new_r],
                                  make_pair(cur.first - 1, new_r)));
          } else {
            q.push_front(make_pair(dist[cur.first - 1][new_r],
                                   make_pair(cur.first - 1, new_r)));
          }
        }
      }
    }
    if (neib[cur.first].second != -1) {
      int new_r = r_ - neib[cur.first].second;
      if (new_r >= 0) {
        if (dist[cur.first + 1][new_r] > dist[cur.first][cur.second] + d_) {
          dist[cur.first + 1][new_r] = dist[cur.first][cur.second] + d_;
          if (d_) {
            q.push_back(make_pair(dist[cur.first + 1][new_r],
                                  make_pair(cur.first + 1, new_r)));
          } else {
            q.push_front(make_pair(dist[cur.first + 1][new_r],
                                   make_pair(cur.first + 1, new_r)));
          }
        }
      }
    }
  }
}
signed main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &d[i]);
  }
  sort(d, d + m);
  for (int i = 0; i < m; ++i) {
    neib[i] = make_pair(-1, -1);
    if (i) {
      neib[i].first = d[i] - d[i - 1];
    }
    if (i != m - 1) {
      neib[i].second = d[i + 1] - d[i];
    }
  }
  scanf("%d%d", &g, &r);
  for (int i = 0; i < m; ++i) {
    fill(dist[i], dist[i] + g, INF);
  }
  bfs();
  int ans = -1;
  for (int i = m - 1; i >= 0; --i) {
    if (n - d[i] > g) {
      break;
    }
    if (dist[i][0] == INF) {
      continue;
    }
    if (ans == -1 || ans > dist[i][0] * (r + g) + n - d[i]) {
      ans = dist[i][0] * (r + g) + n - d[i];
    }
  }
  printf("%d", ans);
  return 0;
}
