#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, G, R;
  cin >> n >> m;
  vector<int> safe(m);
  for (int &x : safe) cin >> x;
  cin >> G >> R;
  sort(safe.begin(), safe.end());
  vector<vector<int> > dist(m + 3, vector<int>(G + 1, 2e9));
  dist[0][0] = 0;
  deque<pair<int, int> > Q;
  Q.push_front(make_pair(0, 0));
  while (Q.size()) {
    pair<int, int> node = Q.front();
    Q.pop_front();
    if (node.second == G) {
      if (dist[node.first][0] > dist[node.first][G] + 1) {
        dist[node.first][0] = dist[node.first][G] + 1;
        Q.push_back(make_pair(node.first, 0));
      }
    } else {
      for (auto it : {node.first - 1, node.first + 1}) {
        if (it >= 0 && it < m) {
          int needed = abs(safe[node.first] - safe[it]);
          if (node.second + needed <= G &&
              dist[it][node.second + needed] > dist[node.first][node.second]) {
            dist[it][node.second + needed] = dist[node.first][node.second];
            Q.push_front(make_pair(it, node.second + needed));
          }
        }
      }
    }
  }
  long long ans = 2e18;
  for (int j = 0; j <= G; j++) {
    if (dist[m - 1][j] != 2e9) {
      ans = min(ans, 1ll * dist[m - 1][j] * (R + G) + j);
    }
  }
  if (ans == 2e18) {
    cout << "-1\n";
    return 0;
  }
  cout << ans << '\n';
  return 0;
}
