#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
void solve() {
  int n, m;
  cin >> n >> m;
  int d[m];
  for (int i = 0; i < m; ++i) {
    cin >> d[i];
  }
  sort(d, d + m);
  int g, r;
  cin >> g >> r;
  int dp[m][(g + r)];
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0] = 0;
  deque<array<int, 2>> dq;
  int ans = INT_MAX;
  dq.push_back({0, 0});
  while (!dq.empty()) {
    auto a = dq.front();
    int curr = a[0];
    int time = a[1];
    dq.pop_front();
    if (time == 0 && d[m - 1] - d[curr] <= g) {
      ans = min(ans, dp[curr][time] * (r + g) + d[m - 1] - d[curr]);
      continue;
    }
    if (time == g && dp[curr][0] == inf) {
      dp[curr][0] = dp[curr][time] + 1;
      dq.push_back({curr, 0});
      continue;
    }
    if (curr) {
      int went = time + d[curr] - d[curr - 1];
      if (went <= g && dp[curr - 1][went] == inf) {
        dp[curr - 1][went] = dp[curr][time];
        dq.push_front({curr - 1, went});
      }
    }
    if (curr + 1 < m) {
      int went = time + d[curr + 1] - d[curr];
      if (went <= g && dp[curr + 1][went] == inf) {
        dp[curr + 1][went] = dp[curr][time];
        dq.push_front({curr + 1, went});
      }
    }
  }
  if (ans == INT_MAX) {
    cout << -1 << "\n";
    return;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) solve();
}
