#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 10003, K = 1000;
const long long inf = 1e18;
int n, m, d[N], g, r, cnt, used[K][N], dt[K * N];
int adj[2][K * N];
int inf2;
deque<int> dq;
void bfs(int s) {
  memset(&dt, 0x3f, sizeof(dt));
  inf2 = dt[0];
  dq.push_back(s);
  dt[s] = 0;
  while (!dq.empty()) {
    int v = dq.front();
    dq.pop_front();
    for (int i = 0; i < 2; i++) {
      int to = adj[i][v], w = 1;
      if (to == 0) {
        continue;
      }
      if (to < 0) {
        to = -to;
        w = 0;
      }
      if (dt[to] > dt[v] + w) {
        dt[to] = dt[v] + w;
        if (w == 0) {
          dq.push_front(to);
        } else {
          dq.push_back(to);
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  memset(&used, -1, sizeof(used));
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> d[i];
  }
  sort(d + 1, d + m + 1);
  cin >> g >> r;
  for (int i = 1; i <= m; i++) {
    if (i > 1) {
      for (int j = 0; j < g; j++) {
        int& v = used[j][i];
        if (v == -1) {
          v = ++cnt;
        }
        int dist = j + d[i] - d[i - 1];
        if (dist > g) {
          continue;
        }
        if (dist == g) {
          dist = 0;
        }
        int& u = used[dist][i - 1];
        if (u == -1) {
          u = ++cnt;
        }
        if (j == 0) {
          adj[0][v] = u;
        } else {
          adj[0][v] = -u;
        }
      }
    }
    if (i < m) {
      for (int j = 0; j < g; j++) {
        int& v = used[j][i];
        if (v == -1) {
          v = ++cnt;
        }
        int dist = j + d[i + 1] - d[i];
        if (dist > g) {
          continue;
        }
        if (dist == g) {
          dist = 0;
        }
        int& u = used[dist][i + 1];
        if (u == -1) {
          u = ++cnt;
        }
        if (j == 0 && i > 1) {
          adj[1][v] = u;
        } else {
          adj[1][v] = -u;
        }
      }
    }
  }
  int s = used[0][1];
  bfs(s);
  long long ans = inf;
  for (int i = 1; i <= m; i++) {
    int v = used[0][i];
    if (v == -1) {
      continue;
    }
    if (g < d[m] - d[i] || dt[v] == inf2) {
      continue;
    }
    long long res = (long long)(dt[v] + (i > 1)) * (r + g) + d[m] - d[i];
    ans = min(ans, res);
  }
  if (ans == inf) {
    ans = -1;
  }
  cout << ans;
}
