#include <bits/stdc++.h>
using namespace std;
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
}
signed main() {
  init();
  long long int n, k;
  cin >> n >> k;
  vector<long long int> x(n);
  for (long long int i = 0; i < n; i++) {
    cin >> x[i];
  }
  long long int a;
  cin >> a;
  vector<long long int> c(n);
  priority_queue<long long int, vector<long long int>, greater<long long int> >
      pq;
  long long int k_cur = k, sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> c[i];
    pq.push(c[i]);
    while (k_cur < x[i]) {
      if (pq.empty()) {
        cout << -1;
        return 0;
      }
      long long int t = pq.top();
      sum += t;
      pq.pop();
      k_cur += a;
    }
  }
  cout << sum;
  return 0;
}
