#include <bits/stdc++.h>
using namespace std;
const int maxn = 200009;
const long long MOD = 119 << 23 | 1;
class {
 public:
  void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    for (int i = 0; i < m; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    int g, r;
    cin >> g >> r;
    vector<vector<int>> dis(m, vector<int>(g + 1, -1));
    vector<pair<int, int>> que;
    que.emplace_back(0, g);
    dis[0][g] = 0;
    while (que.size()) {
      for (int i = 0; i < que.size(); ++i) {
        int x = que[i].first, y = que[i].second;
        if (x > 0) {
          int d = a[x] - a[x - 1];
          if (y >= d) {
            if (dis[x - 1][y - d] == -1) {
              dis[x - 1][y - d] = dis[x][y];
              que.emplace_back(x - 1, y - d);
            }
          }
        }
        if (x < m - 1) {
          int d = a[x + 1] - a[x];
          if (y >= d) {
            if (dis[x + 1][y - d] == -1) {
              dis[x + 1][y - d] = dis[x][y];
              que.emplace_back(x + 1, y - d);
            }
          }
        }
      }
      vector<pair<int, int>> que2;
      for (int i = 0; i < que.size(); ++i) {
        if (que[i].second == 0) {
          if (dis[que[i].first][g] == -1) {
            que2.emplace_back(que[i].first, g);
            dis[que[i].first][g] = dis[que[i].first][0] + 1;
          }
        }
      }
      swap(que2, que);
    }
    long long ans = -1;
    for (int i = 0; i <= g; ++i) {
      if (dis[m - 1][i] != -1) {
        ans = ans == -1 ? dis[m - 1][i] * (g + r) + (g - i)
                        : min(ans, 1ll * dis[m - 1][i] * (g + r) + (g - i));
      }
    }
    cout << ans << '\n';
  }
} NSPACE;
int main() {
  ;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}
