#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 5;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  long long a;
  cin >> a;
  long long c[n];
  for (long long int i = 0; i < n; i++) cin >> c[i];
  long long ans = 0, f = 0;
  priority_queue<long long, vector<long long>, greater<long long> > pq;
  for (long long int i = 0; i < n; i++) {
    if (arr[i] <= k) {
      pq.push(c[i]);
    } else if (arr[i] > k) {
      pq.push(c[i]);
      long long gap = arr[i] - k;
      gap = ceil(gap * 1.0 / a);
      if (pq.size() >= gap) {
        while (gap--) {
          ans += pq.top();
          pq.pop();
          k += a;
        }
      } else {
        f = 1;
        break;
      }
    }
  }
  if (f)
    cout << -1 << "\n";
  else
    cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
