#include <bits/stdc++.h>
using namespace std;
long long n, k, x[100005], a, p[100005];
priority_queue<int, vector<int>, greater<int>> q;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> x[i];
  cin >> a;
  for (int i = 1; i <= n; i++) cin >> p[i];
  long long has = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    q.push(p[i]);
    long long ned = max(0ll, x[i] - k);
    ned = (ned + a - 1) / a;
    while (!q.empty() && has < ned) {
      ans += q.top();
      q.pop();
      has++;
    }
    if (has < ned) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}
