#include <bits/stdc++.h>
using namespace std;
int d[10010];
int f[10010][1010];
deque<pair<int, int> > dq;
int main() {
  int n, m, g, r;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d", &d[i]);
  sort(d + 1, d + m + 1);
  scanf("%d%d", &g, &r);
  memset(f, -1, sizeof(f));
  f[1][g] = 0;
  dq.push_back({1, g});
  while (!dq.empty()) {
    int pos = dq.front().first;
    int cnt = dq.front().second;
    dq.pop_front();
    if (pos > 1 && cnt >= d[pos] - d[pos - 1]) {
      int k = cnt - d[pos] + d[pos - 1];
      if (f[pos - 1][k] < 0) {
        f[pos - 1][k] = f[pos][cnt];
        dq.push_front({pos - 1, k});
        if (k == 0 && f[pos - 1][g] < 0) {
          f[pos - 1][g] = f[pos][cnt] + 1;
          dq.push_back({pos - 1, g});
        }
      }
    }
    if (pos < m && cnt >= d[pos + 1] - d[pos]) {
      int k = cnt - d[pos + 1] + d[pos];
      if (f[pos + 1][k] < 0) {
        f[pos + 1][k] = f[pos][cnt];
        dq.push_front({pos + 1, k});
        if (k == 0 && f[pos + 1][g] < 0) {
          f[pos + 1][g] = f[pos][cnt] + 1;
          dq.push_back({pos + 1, g});
        }
      }
    }
  }
  long long ans = 1e18;
  for (int i = 0; i <= g; i++) {
    if (f[m][i] >= 0) ans = min(ans, (long long)f[m][i] * (r + g) + g - i);
  }
  if (ans == 1e18)
    printf("-1\n");
  else
    printf("%lld\n", ans);
  return 0;
}
