#include <bits/stdc++.h>
using namespace std;
const int M = 1e7 + 1e6;
int n, m, g, h, a[10010], l = 1e7, r = 1e7 - 1, f[10010][1010], q1[M],
                          ans = 1e9;
bool vis[10010][1010];
pair<int, int> q[M];
void BFS() {
  q[++r] = make_pair(1, 0);
  q1[l] = 0;
  while (l <= r) {
    int x = q[l].first, y = q[l].second;
    l++;
    if (vis[x][y]) continue;
    vis[x][y] = 1;
    f[x][y] = q1[l - 1];
    if (x > 1) {
      if (a[x] - a[x - 1] + y < g)
        q[--l] = make_pair(x - 1, a[x] - a[x - 1] + y), q1[l] = f[x][y];
      else if (a[x] - a[x - 1] + y == g && vis[x - 1][0] == 0)
        q[++r] = make_pair(x - 1, 0), q1[r] = f[x][y] + 1;
    }
    if (x < m) {
      if (a[x + 1] - a[x] + y < g)
        q[--l] = make_pair(x + 1, a[x + 1] - a[x] + y), q1[l] = f[x][y];
      else if (a[x + 1] - a[x] + y == g && vis[x + 1][0] == 0)
        q[++r] = make_pair(x + 1, 0), q1[r] = f[x][y] + 1;
    }
  }
  if (vis[m][0]) ans = max(f[m][0] * (g + h) - h, 0);
  for (int i = 1; i < g; i++)
    if (vis[m][i]) ans = min(ans, f[m][i] * (g + h) + i);
  if (ans == 1e9)
    printf("-1");
  else
    printf("%d", ans);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  sort(a + 1, a + m + 1);
  cin >> g >> h;
  BFS();
}
