#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int x;
  cin >> x;
  long long int c[n];
  priority_queue<long long int, vector<long long int>, greater<long long int> >
      pq;
  for (long long int i = 0; i < n; i++) {
    cin >> c[i];
  }
  long long int d = 0;
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    pq.push(c[i]);
    if (a[i] > k + x * d) {
      while (!pq.empty() && a[i] > k + x * d) {
        ans += pq.top();
        pq.pop();
        d++;
      }
      if (a[i] > k + x * d) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << ans << endl;
}
