#include <bits/stdc++.h>
using namespace std;
const long double pai = acos(-1.0L);
const long double eps = 1e-10;
const long long mod = 1e9 + 7;
const int MXN = 1e6 + 5;
int a[MXN], g, r, n, m;
int vis[10004][1005];
struct no {
  int v, t, tt;
};
int _01bfs() {
  deque<no> q;
  q.push_front(no{1, 0, 0});
  vis[1][0] = 1;
  int ans = INT_MAX;
  while (!q.empty()) {
    int nowid = q.front().v, totdis = q.front().t, thisdis = q.front().tt;
    q.pop_front();
    int ddd = a[m] - a[nowid];
    int hhh = g - thisdis;
    if (hhh >= ddd) ans = min(ans, totdis + ddd);
    if (nowid != 1) {
      int dis = a[nowid] - a[nowid - 1];
      int have = g - thisdis;
      if (dis < have && vis[nowid - 1][thisdis + dis] == 0) {
        vis[nowid - 1][thisdis + dis] = 1;
        q.push_front(no{nowid - 1, totdis + dis, thisdis + dis});
      } else if (dis == have && vis[nowid - 1][0] == 0) {
        vis[nowid - 1][0] = 1;
        q.push_back(no{nowid - 1, totdis + dis + r, 0});
      }
    }
    if (nowid != m) {
      int dis = -a[nowid] + a[nowid + 1];
      int have = g - thisdis;
      if (dis < have && vis[nowid + 1][thisdis + dis] == 0) {
        vis[nowid + 1][thisdis + dis] = 1;
        q.push_front(no{nowid + 1, totdis + dis, thisdis + dis});
      } else if (dis == have && vis[nowid + 1][0] == 0) {
        vis[nowid + 1][0] = 1;
        q.push_back(no{nowid + 1, totdis + dis + r, 0});
      }
    }
  }
  return ans;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  cin >> g >> r;
  sort(a + 1, a + 1 + m);
  int ans = _01bfs();
  if (ans == INT_MAX) ans = -1;
  cout << ans << '\n';
  return 0;
}
