#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 1000001;
const int kMaxM = 10001;
const int kMaxG = 1001;
int d[kMaxM], l[kMaxN], q[kMaxN];
bool b[kMaxM][kMaxG];
int n, m, g, r, h, t, ans;
void Search(int x, int g) {
  if (b[x][g]) {
    return;
  }
  b[x][g] = 1;
  if (!g) {
    if (!l[x]) {
      q[++t] = x;
      l[x] = l[q[h]] + 1;
    }
    return;
  }
  if (x > 1 && g >= d[x] - d[x - 1]) {
    Search(x - 1, g - d[x] + d[x - 1]);
  }
  if (x < m && g >= d[x + 1] - d[x]) {
    Search(x + 1, g - d[x + 1] + d[x]);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> d[i];
  }
  sort(d + 1, d + 1 + m);
  cin >> g >> r;
  h = 0, t = 1;
  q[1] = l[1] = 1;
  while (h++ < t) {
    Search(q[h], g);
  }
  ans = ~(1 << 31);
  for (int i = 1; i <= m; i++) {
    if (n - d[i] <= g && l[i]) {
      ans = min(ans, (g + r) * (l[i] - 1) + n - d[i]);
    }
  }
  cout << (ans == ~(1 << 31) ? -1 : ans);
  return 0;
}
