#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 1e5 + 33;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> x(n), c(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  long long a;
  cin >> a;
  set<long long> s;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  long long ans = 0, num = k;
  for (int i = 0; i < n; i++) {
    s.insert(c[i]);
    if (x[i] > num) {
      while (num < x[i] && s.size()) {
        ans += *s.begin();
        s.erase(*s.begin());
        num += a;
      }
    }
    if (x[i] > num) {
      cout << -1;
      return;
    }
  }
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
}
