#include <bits/stdc++.h>
using namespace std;
const int N = 10000, G = 1000, INF = 0x3f3f3f3f;
int xx[N], qu[G + 1][N], cnt[G + 1];
bool used[G + 1][N];
int main() {
  int x_, n;
  cin >> x_ >> n;
  for (int i = 0; i < n; i++) cin >> xx[i];
  int g, r;
  cin >> g >> r;
  sort(xx, xx + n);
  used[0][0] = true, qu[0][cnt[0]++] = 0;
  int k = 0;
  while (cnt[0]) {
    int ans = INF;
    for (int h = 0; h < g; h++) {
      for (int j = 0; j < cnt[h]; j++) {
        int i = qu[h][j];
        for (int di = -1; di <= 1; di += 2) {
          int i_ = i + di;
          if (i_ >= 0 && i_ < n) {
            int x = abs(xx[i] - xx[i_]);
            int h_ = h + x;
            if (h_ <= g && !used[h_][i_]) {
              if (i_ == n - 1) ans = min(ans, k * (g + r) + h_);
              used[h_][i_] = true, qu[h_][cnt[h_]++] = i_;
            }
          }
        }
      }
      cnt[h] = 0;
    }
    if (ans != INF) {
      cout << ans << '\n';
      return 0;
    }
    k++;
    for (int j = 0; j < cnt[g]; j++) {
      int i = qu[g][j];
      used[0][i] = true, qu[0][cnt[0]++] = i;
    }
    cnt[g] = 0;
  }
  cout << "-1\n";
  return 0;
}
