#include <bits/stdc++.h>
using namespace std;
const int MM = 10005, MG = 1005, inf = 1000000005, mod = 1000000007;
const long long INF = 1000000000000000005LL;
vector<int> W;
int n, m, r, g;
deque<pair<int, int> > Q;
int odl[MM][MG];
void bfs() {
  Q.push_front({0, 0});
  while (!Q.empty()) {
    pair<int, int> cur = Q.front();
    Q.pop_front();
    int a, z, o = odl[cur.first][cur.second];
    ;
    if (cur.first) {
      a = W[cur.first] - W[cur.first - 1];
      z = a + cur.second;
      if (z <= g) {
        if (!odl[cur.first - 1][z] || odl[cur.first - 1][z] > o) {
          odl[cur.first - 1][z] = o;
          Q.push_front({cur.first - 1, z});
        }
      }
    }
    if (cur.first < m - 1) {
      a = W[cur.first + 1] - W[cur.first];
      z = a + cur.second;
      if (z <= g) {
        if (!odl[cur.first + 1][z] || odl[cur.first + 1][z] > o) {
          odl[cur.first + 1][z] = o;
          Q.push_front({cur.first + 1, z});
        }
      }
    }
    if (cur.second == g) {
      if (!odl[cur.first][0] || odl[cur.first][0] > o + 1) {
        odl[cur.first][0] = o + 1;
        Q.push_back({cur.first, 0});
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int d;
    scanf("%d", &d);
    W.push_back(d);
  }
  sort((W).begin(), (W).end());
  scanf("%d%d", &g, &r);
  odl[0][0] = 1;
  bfs();
  long long ans = INF;
  for (int i = 0; i <= g; ++i) {
    if (!odl[m - 1][i]) continue;
    ans = min(ans, 1LL * (r + g) * (odl[m - 1][i] - 1) + (long long)i);
  }
  if (ans == INF) ans = -1;
  printf("%lld", ans);
}
