#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 1e6;
const int mx = 10005;
int dp[mx][1005];
int arr[mx];
int n, m, g, r;
int func(int idx, int gre) {
  int i, j, k, now, p;
  for (i = 0; i <= m; i++) {
    for (j = 0; j <= g; j++) {
      dp[i][j] = inf;
    }
  }
  deque<pair<int, int> > q;
  q.push_back(make_pair(idx, gre));
  dp[idx][gre] = 0;
  int dis, here, green;
  while (!q.empty()) {
    now = q.front().first;
    green = q.front().second;
    q.pop_front();
    if (now == m - 1) continue;
    if (now) {
      dis = arr[now] - arr[now - 1];
      if (dis < green && (dp[now - 1][green - dis] > dp[now][green])) {
        dp[now - 1][green - dis] = dp[now][green];
        q.push_front(make_pair(now - 1, green - dis));
      } else if (dis == green && (dp[now - 1][g] > dp[now][green] + 1)) {
        dp[now - 1][g] = 1 + dp[now][green];
        q.push_back(make_pair(now - 1, g));
      }
    }
    dis = arr[now + 1] - arr[now];
    if (dis < green && (dp[now + 1][green - dis] > dp[now][green])) {
      dp[now + 1][green - dis] = dp[now][green];
      q.push_front(make_pair(now + 1, green - dis));
    } else if (dis == green) {
      if ((dp[now + 1][g] > 1 + dp[now][green])) {
        dp[now + 1][g] = 1 + dp[now][green];
        q.push_back(make_pair(now + 1, g));
      }
    }
  }
  int ans = inf, ret;
  if (dp[m - 1][g] != inf) {
    ret = (dp[m - 1][g] - 1) * (r + g) + g;
    ans = min(ans, ret);
  }
  for (i = 0; i < g; i++) {
    if (dp[m - 1][i] == inf) continue;
    ret = dp[m - 1][i] * (r + g) + g - i;
    ans = min(ans, ret);
  }
  return ans;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", arr + i);
  }
  sort(arr, arr + m);
  scanf("%d %d", &g, &r);
  memset(dp, -1, sizeof(dp));
  int ans = func(0, g);
  if (ans == inf) ans = -1;
  printf("%d\n", ans);
  return 0;
}
