#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long p[10005];
long long mmin[10005][1005];
long long bfs[1005][10005];
long long head[1005];
long long distl[10005], distr[10005], self[1005];
long long g, r;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    cin >> p[i];
  }
  cin >> g >> r;
  sort(p + 1, p + m + 1);
  for (long long i = 1; i <= m; i++) {
    distl[i] = p[i] - p[i - 1];
    distr[i] = p[i + 1] - p[i];
  }
  for (long long i = 1; i <= m; i++) {
    for (long long j = 0; j < g; j++) {
      mmin[i][j] = 1000000000;
    }
  }
  long long slf = 0;
  mmin[1][0] = 0;
  head[0]++;
  bfs[0][1] = 1;
  long long sumhead = 1;
  for (long long i = 0, j = 0;; i++, j++) {
    if (j >= g) j = 0;
    while (head[j]) {
      if (bfs[j][head[j]] > 1) {
        if (j + distl[bfs[j][head[j]]] <= g) {
          long long nxt = j + distl[bfs[j][head[j]]];
          if (nxt == g) nxt = 0;
          if (mmin[bfs[j][head[j]] - 1][nxt] > i + distl[bfs[j][head[j]]]) {
            mmin[bfs[j][head[j]] - 1][nxt] = i + distl[bfs[j][head[j]]];
            if (nxt == j) {
              slf++;
              self[slf] = bfs[j][head[j]] - 1;
            } else {
              head[nxt]++;
              sumhead++;
              bfs[nxt][head[nxt]] = bfs[j][head[j]] - 1;
            }
          }
        }
      }
      if (bfs[j][head[j]] < m) {
        if (j + distr[bfs[j][head[j]]] <= g) {
          long long nxt = j + distr[bfs[j][head[j]]];
          if (nxt == g) nxt = 0;
          if (mmin[bfs[j][head[j]] + 1][nxt] > i + distr[bfs[j][head[j]]]) {
            mmin[bfs[j][head[j]] + 1][nxt] = i + distr[bfs[j][head[j]]];
            if (nxt == j) {
              slf++;
              self[slf] = bfs[j][head[j]] + 1;
            } else {
              head[nxt]++;
              sumhead++;
              bfs[nxt][head[nxt]] = bfs[j][head[j]] + 1;
              ;
            }
          }
        }
      }
      head[j]--;
      sumhead--;
    }
    while (slf) {
      head[j]++;
      sumhead++;
      bfs[j][head[j]] = self[slf];
      slf--;
    }
    if (sumhead == 0) break;
  }
  long long ans = 1000000000;
  for (long long i = 1; i <= m; i++) {
    if (n - p[i] <= g && mmin[i][0] < 1000000000) {
      ans = min(ans, mmin[i][0] + n - p[i] + mmin[i][0] * r / g);
    }
  }
  if (ans >= 1000000000) {
    cout << -1;
  } else {
    cout << ans;
  }
}
